All right, nobody else has, so I'll take the bait. ;-)

For those who may not have seen them before (*cough* young whipper-snappers), uuencode and uudecode are encoding and decoding mechanisms that were originally developed to allow transmitting binary files via uucp over lines that were not always eight-bit-clean. Just like MIME.

Now, on to the real decode. I've separated the lines to make them a little easier to read.

# # Set $$ -- usually the PID of the running Perl, but not a read-only # variable -- to a strange string: first part looks like code, # but latter half looks like junk. If you uudecode the junk (minus # the embedded newline) you get: # # $_=q!$_='print "Just another Perl hacker"'!; # $$ = q{$_=unpack'u',q|L)%\]<2$D7STG<')I;G0@(DIU<W0@86YO=&AE<B! 097)L(&AA8VME<B(G(3L`|;}; # # Set $} -- another strange variable -- to another strange string. # This time the uuencoded part (again minus \n) is # # $_='$_=q!($_)=($$=~/.*/g)!'; # $} = q{$_=unpack'u',q|<)%\])R1?/7$A*" 1?*3TH)"0]?B\N*B]G*2$G.P``|;}; # # The next few lines remove embedded newlines in $$ and $} (first # and fourth lines), and set these variables to these values: # $; $_=$}; (second line) # $_ $_\n=$;; (third line, including embedded newline) # $$=~s;\n;;g; $;=q;$_=$};; $_='$_ =$;;'; $}=~s;\n;;g; # # Each of these evals executes the code in $_. Before the first, # $_ contains "$_\n=$;;" as shown above. Here are the values of $_ # after each eval completes. # eval; # $_=$}; eval; # $_=unpack'u',q|<)%\\])R1?/7$A*"1?*3TH)"0]?B\\N*B]G*2$G.P``|; eval; # $_='$_=q!($_)=($$=~/.*/g)!'; eval; # ($_)=($$=~/.*/g) # BTW, the parens and "=~ /.*/g" do nothing. # Executing this is the same as "$_ = $$". eval; # $_=unpack'u',q|L)%\\]<2$D7STG<\')I;G0@(DIU<W0@86YO=&AE<B!097)L(& +AA8VME<B(G(3L`|; eval; # $_=q!$_='print "Just another Perl hacker"'!; eval; # $_='print "Just another Perl hacker"' eval; # print "Just another Perl hacker" eval; # The final eval just executes the contents of $_ seen above. eval;
BTW, if you try to execute this in the debugger, beware: setting $$ causes it to fork. Fiendishly clever!

In reply to Re: Careful Evaluation by VSarkiss
in thread Careful Evaluation by iamcal

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.