This japh made me curious, so well.. i just couldn't resist breaking it apart..

!!! SPOILER !!!

Breaking the Japh up, we get:

$J=qw,34+40;117;79+36;(116);32;,; $s=sub{eval(shift())};#This is my eval @u=('a'..'z'); $J.=qw:97;110;111;(116-0);104;101;114;(16*2);:;#from hell $s=sub{eval(shift())}; $J.=qw:;112;101;114;108;32:;#JAPH. It isn't very $t=sub{ my@e=@u; my$u=16; $t_=sub{"$e[$u+2]$e[$u]$e[++$u]$e[++$u+1] $_[0]"}; &$s(&$t_(shift())) }; $e=sub{ $t_=sub{"$u[&$t(4)]$u[7]$u[17] $_[0]"};#ha- &$s(&$t_(shift())); }; $J.=qw:;104;97;99;107;101;114:; $f=sub{ $t_=sub {"$u[15]$u[17]$u[8]$u[13]$u[19]($_[0])"}; &$s(&$t_(shift())); };#to figu- $_=$g+=$s; $g=sub{ $t_=sub{"$u[5]$u[14]$u[17](@_)"}; &$s(&$t_(eval@_)); }; print (&$e(&$s($_)))for(split(/;/,$J)); print "\n";#-re out at all;-)

-------------------------------------------

Now let's put everything where it belongs:

$s=sub{eval(shift())}; this was defined twice. The arguments passed to $s end up in @_ from which the first argument is taken off by the shift()-function in eval(shift()) which results in evaluating the first argument passed to $s.

$J is assigned to 4 times, last 3 are concatenations. In between the assignments $J doesn't chang, so now in 1 assignment:

$J="34+40;117;79+36;(116);32;97;110;111;(116-0);104;101;114;(16*2);112;101;114;108;32;104;97;99;107;101;114";

When we simplify $t=sub { } we get

  1. $t=sub { s q r t $t_=sub{"$e[18]$e[$16]$e[17]$e[19] $_[0]"}; + &$s(&$t_(shift())) }
  2. $t=sub { $t_="sqrt $_[0]"; &$s( $t_ ) }
  3. $t=sub { sqrt $_[0]; } # &$s merely evaluates the string

Doing the same to $e=sub { } we get:

  1. &$t(4) is the same as sqrt(4).
    $e=sub{ c h r $t_=sub{"$u[&$t(4)]$u[7]$u[17] $_[0]"};#ha- &$s(&$t_(shift())); };
  2. $e=sub { chr($_[0] ) };

The function $f is never called, nor is the function $g.
$_=$g+=$s; is meaningless, as the $_ isn't being used until after it's been reassigned something else.

Now we are down to the last 2 lines print (&$e(&$s($_)))for(split(/;/,$J)); is equivalent to:

for ( split(/;/,$J) ) { print ($&e(&$s($_)); }

As the function $e got simplified to chr( $_[0] ) and the $s function does an evaluate on its string, we can write the print line as print chr(eval($_));

The elements in $J sometimes need to be parsed for chr to understand them. As eval and subroutines return the result of the last expression evaluated to the caller, the eval can be removed by simplifying $J to @J. ( I simplified the string, but also changed it to an array to remove the split in the for loop).

The Japh then comes down to:

@J =( 74,117,115,116,32,97,110,111,116,104,101,114,32,112,101,114,108, +32,104,97,99,107,101,114); for ( @J ) { print chr( $_ ); } print "\n";

For those reading the spoiler: I would appreciate feedback to it.


In reply to Re: eval from heck by deliria
in thread eval from heck by krisahoch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.