<?xml version="1.0" encoding="windows-1252"?>
<node id="291495" title="Re: Pe(a)rls in line noise" created="2003-09-15 02:28:03" updated="2005-03-25 18:50:19">
<type id="11">
note</type>
<author id="287641">
Roger</author>
<data>
<field name="doctext">
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! &lt;br&gt;&lt;br&gt;
&lt;code&gt;
@; = (491036,8051555,4785250,3341086,912133,189089,691108);
&lt;/code&gt;
# This is just an eye candy, an array placeholder of 7 elements&lt;br&gt;
&lt;code&gt;
%; = qw/
       He
       didn't,Just
       do
       to,Perl
       didn't
       understand,another
       it
       would,hacker!
       /;
&lt;/code&gt;
# This constructs the %; hash variable with 4 entries, namely He, do, didn't, it:&lt;br&gt;
&lt;code&gt;
  He =&gt; didn't,Just
  do =&gt; do,perl
  didn't =&gt; understand,another
  it =&gt; would, hacker!
&lt;/code&gt;
&lt;code&gt;
%: = 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 &lt;7874@jpl-devvax.JPL.NASA.GOV&gt;
================================= ==================================
    /;
&lt;/code&gt;
This builds another hash lookup - %:&lt;br&gt;
&lt;code&gt;
{ # required by redo, where to start for the redo
    /./ ? eval(join 't, ', qw:prin exi delphi:) : /./;
&lt;/code&gt;
This is really (translated to):&lt;br&gt;
&lt;code&gt;
    /./ ? { print, exit, delphit, } : /./;
&lt;/code&gt;
or just&lt;br&gt;
&lt;code&gt;
    /./ ? { print, exit, } : /./;
&lt;/code&gt;
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).&lt;br&gt;
&lt;code&gt;
    $:{do} = 'to';
&lt;/code&gt;
# Another clever bit, insert the required 'do=&amp;gt;to' lookup pair into the hash table. How this is used will be explored later.
&lt;code&gt;
    @; = map { join ',', '', $_, '' } values(%;);
&lt;/code&gt;
Translates the values to the %; hash to ",xxx,", required by the lookup below&lt;br&gt;
This translation is clever:&lt;br&gt;
The key-value pairs in the %: hash so far&lt;br&gt;
&lt;code&gt;
    He =&gt; didn't
    didn't =&gt; understand
    do =&gt; to  # manually inserted before
    it =&gt; would
&lt;/code&gt;
And then... Modify the hash table %:, with values from the %; lookup.&lt;br&gt;
&lt;code&gt;
    eval '$:{q?'.$_.'?}=~s'.shift@; for keys(%;); 
&lt;/code&gt;
So that:&lt;br&gt;
&lt;code&gt;
   He =&gt; Just
   didn't =&gt; another
   do =&gt; Perl
   it =&gt; Hacker!
&lt;/code&gt;
This next bit just creates the string to be printed. :-)&lt;br&gt;
&lt;code&gt;
    $_ = qq{@{[@:{qw{ He didn't do it }}]}};
&lt;/code&gt;

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...
&lt;code&gt;
    redo } x:
&lt;/code&gt;</field>
<field name="root_node">
291267</field>
<field name="parent_node">
291267</field>
</data>
</node>
