in reply to Pe(a)rls in line noise
# This is just an eye candy, an array placeholder of 7 elements@; = (491036,8051555,4785250,3341086,912133,189089,691108);
# This constructs the %; hash variable with 4 entries, namely He, do, didn't, it:%; = qw/ He didn't,Just do to,Perl didn't understand,another it would,hacker! /;
He => didn't,Just do => do,perl didn't => understand,another it => would, hacker!
This builds another hash lookup - %:%: = 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 is really (translated to):{ # required by redo, where to start for the redo /./ ? eval(join 't, ', qw:prin exi delphi:) : /./;
or just/./ ? { print, exit, delphit, } : /./;
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)././ ? { print, exit, } : /./;
# Another clever bit, insert the required 'do=>to' lookup pair into the hash table. How this is used will be explored later.$:{do} = 'to';
Translates the values to the %; hash to ",xxx,", required by the lookup below@; = map { join ',', '', $_, '' } values(%;);
And then... Modify the hash table %:, with values from the %; lookup.He => didn't didn't => understand do => to # manually inserted before it => would
So that:eval '$:{q?'.$_.'?}=~s'.shift@; for keys(%;);
This next bit just creates the string to be printed. :-)He => Just didn't => another do => Perl it => Hacker!
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...$_ = qq{@{[@:{qw{ He didn't do it }}]}};
redo } x:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Pe(a)rls in line noise
by liz (Monsignor) on Sep 15, 2003 at 08:12 UTC | |
by Roger (Parson) on Sep 16, 2003 at 01:31 UTC |