http://www.perlmonks.org?node_id=291495


in reply to Pe(a)rls in line noise

Hi Liz, this is my attempt at decoding this clever JAPH, in fact my first attempt at decoding any JAPH, so please correct (and forgive) my analysis if wrong!

@; = (491036,8051555,4785250,3341086,912133,189089,691108);
# This is just an eye candy, an array placeholder of 7 elements
%; = qw/ He didn't,Just do to,Perl didn't understand,another it would,hacker! /;
# This constructs the %; hash variable with 4 entries, namely He, do, didn't, it:
He => didn't,Just do => do,perl didn't => understand,another it => would, hacker!
%: = qw/ ================================= ================================== Randal said it would be tough to do in sed. He didn't say he didn't understand sed. Randal understands sed quite well. Which is why he uses Perl. :-) -- Larry Wall in <7874@jpl-devvax.JPL.NASA.GOV> ================================= ================================== /;
This builds another hash lookup - %:
{ # required by redo, where to start for the redo /./ ? eval(join 't, ', qw:prin exi delphi:) : /./;
This is really (translated to):
/./ ? { print, exit, delphit, } : /./;
or just
/./ ? { print, exit, } : /./;
Clever, the first time this loop is enterred, $_ is undef, so the print and exit is not performed. delphit would have no effect (after the exit).
$:{do} = 'to';
# Another clever bit, insert the required 'do=>to' lookup pair into the hash table. How this is used will be explored later.
@; = map { join ',', '', $_, '' } values(%;);
Translates the values to the %; hash to ",xxx,", required by the lookup below
This translation is clever:
The key-value pairs in the %: hash so far
He => didn't didn't => understand do => to # manually inserted before it => would
And then... Modify the hash table %:, with values from the %; lookup.
eval '$:{q?'.$_.'?}=~s'.shift@; for keys(%;);
So that:
He => Just didn't => another do => Perl it => Hacker!
This next bit just creates the string to be printed. :-)
$_ = qq{@{[@:{qw{ He didn't do it }}]}};
The next bit goes back to the beginning of the loop, with $_ set to "Just another Perl hacker!", and of cause the print, exit, code will take over from there...
redo } x: