Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Wow... I'm trying to pick apart how this works, but I'm getting lost in all the map transforms. Here's a few interesting notes that I've found so far... Warning: Spoilers!

There's some stuff that is unused... disinformation?
sub ::{ ; my $i=$^; ; [split /#/, join $`, map {$i^=$_} split//,pop @_ ] }
and
%_ = map { my $z = (($_|=$^O)?$_:::($_)); $_, sub { while (pop) { my $x = unpack 'V',$_ ; push @| , ($x > $_ ? $x : $_ ) } print for @| } } 1..1024; ;

this bit of code is a fun transformation:

sub _ { +(@;=>@:) = map {[split//]} @_; for (1..9) { push @: , join $&, map { shift @$_} @; } @: }
It takes an array or words, and returns an array of words. The first word of the returned array is composed of the first letters of the words in the input. the second words is composed of the second letters... and so on.

It is used here:

join ' ', @{[_(qw(oepgnf rhnuar nfarqr gu))]}[2,$?,3,$|,@;,5]
This re-orders the words output by the "_" function. 2,0,3,1,0,0,0,0,5 is the order. (Abuse of special variables here.)

Yet more abuse of special variables:

($;,$:,$,,$\,$^,$==>$~,$.,$})=
These variables are referenced below, and are set to various rot13 strings. One of which was created by the "_" function above.
One interesting side effect it the $\ variable. It puts an exclamation point and newline on the output record seperator, which I think puts it at the end of the output whenever this program is run.
I think this looks like a ROT13 mapping:
map{sub { my $i=$!; join $&, map {my $o = $i; $i = $_; $o^$_; } split //,shift }; y;a-z;n-za-m;;$_; } @$_
yes.. because it rot13's the following code:
([q"Ia Sbivrg ", "rf lbh", "Rhffvn, $: $~" ], ["Ayy lbhe $~", " ner orybat gb hf", "rq $:" ], ["$; ornh", "rq $:", "jhys pyhfgre bs $~" ], ["$|. We".'v'."gr $~","$/3. Pebsvg", "r".qq-q-.' '.$:.".$/$=. ???" ], ["Tur arkg "."$: $~"=>"ef $} vg"." rneyl",q"vba jvyy ".'or'.qq' $^ fb +ba, ohg $.$,' ] )
Substitute in the special variables above, consolidate several cancatenations, and that would result in the array or strings to output.

Finally, that array is mapped to subroutines that output a given string, and placed in a hash:

@%= map { my $die =$_; sub { print for join $', @$die[ $%,$==>$|] } }
of which one is then executed:
$%[rand @%]->();

OMG. That's the first time I've ever de-obfuscated a program. :) ++vroom! Good obfuscation, nice presentation, and funny output for slashdot readers.


In reply to Re: Slashdot lamejoke generator by Notromda
in thread Slashdot lamejoke generator by jonadab

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2022-10-04 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (18 votes). Check out past polls.

    Notices?