for((112,97,99,107)){$s.=chr $_}; ($z="``'=``:=`~,=``~=``{=;'=``'=+}=++=`~}=;". "'=;+=++=:'=;+=::=:~=,,=,'=::=,'=,:=::=,:=,;". "=::=,'=,:=::=,{=:_=::=,'=,:=::=,,=,~=::=,'=,". ":=::=:+=:_=:`=,+=`~")=~tr/~`';:,{}_+=/0-9i/; eval "\$_=$s 'c*', qw/@{[split /i/,$z]}/;";print;
I was wondering if others have done similar ones.
chas

Replies are listed 'Best First'.
Re: A "recursive" JAPH
by K_M_McMahon (Hermit) on Feb 16, 2005 at 01:07 UTC
    When I run this, I get print pack 'c*',(74,46,65,46,80,46,72,46,10);

    If you change the last print to eval it works.
    for((112,97,99,107)){$s.=chr $_}; ($z="``'=``:=`~,=``~=``{=;'=``'=+}=++=`~}=;". "'=;+=++=:'=;+=::=:~=,,=,'=::=,'=,:=::=,:=,;". "=::=,'=,:=::=,{=:_=::=,'=,:=::=,,=,~=::=,'=,". ":=::=:+=:_=:`=,+=`~")=~tr/~`';:,{}_+=/0-9i/; eval "\$_=$s 'c*', qw/@{[split /i/,$z]}/;";eval;



    -Kevin
    my $a='62696c6c77667269656e6440676d61696c2e636f6d'; while ($a=~m/(^.{2})/s) {print unpack('A',pack('H*',"$1"));$a=~s/^.{2}//s;}
      Kevin, Yes, but the the idea of "recursive" is that this code prints code that prints J.A.P.H. if you run it. One could similarly have code that prints code that prints code that prints J.A.P.H. I guess this is a bit warped...
      chas
Re: A "recursive" JAPH
by teamster_jr (Curate) on Feb 16, 2005 at 15:55 UTC
    it's quite a common thing to encode something and then eval it, to print it out is a bit different, although i quite often use the technique to show the script's own source code (i believe these scripts are called quines, but someone will no doubt correct me!), usually whilst evalling it.

    for example: whitespace evil?
    al

Re: A "recursive" JAPH
by blazar (Canon) on Feb 16, 2005 at 09:14 UTC
    IK'm not really sure if I would call this recursive, but I like the basic idea. As a matter of personal taste I also would try to format it in a "more regular" shape.