Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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

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 How to display code and escape characters are good places to start.
Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-05-24 19:19 GMT
Find Nodes?
    Voting Booth?

    No recent polls found