This is my first obfuscated code, so it's probably not too great, but here it is:

This code plays around with eval and pack a bit. I got a little uncreative near the end and just stuck the numbers straight in, but oh well.

$a="0"x((eval join'+',1..10)-5);($a)=map{$_}$a=~y/0//; $b=pack("C",67);$_=pack($b,pack($b,$a+4).pack($b,$a+6)); eval;sub D{$_=eval(join'*',1..5)-eval(join'+',1..9)-1; $_.=$".ord(chr($_+ord'+'));$_.=$".ord(chr($_ +(eval( join('+',2<<4,2<<2,2)))-1));$_.=$".ord(chr($_+(eval( join('+',2<<4,2<<2,2)))));print map{chr}split;print map{chr}32,65,110,111,116,104,101,114;print map{chr} 32,80,101,114,108;print map{chr}32,72,97,99,107,101,114; }


The 15 year old, freshman programmer,
Stephen Rawls

Replies are listed 'Best First'.
Re: Just another JAPH
by tachyon (Chancellor) on May 21, 2001 at 07:25 UTC
    my $answer=[q;7566626f206f7420756f7920656d6f636c65772049;]; print join''=>reverse split''=>pack H42=>$answer->[-1]=>eval; tachyon Here is a quick dissection, you definitely got slack at the end! $a="0"x((eval join'+',1..10)-5); # $a = '0'x50 ($a)=map{$_}$a=~y/0//; # $a = 50; $b=pack("C",67); # $b = 'C' $_=pack($b,pack($b,$a+4).pack($b,$a+6)); # $b = 'D' eval; # eval $_ => calls D() # preceeding code could be replaced by &D so it is basically fill; sub D{ $_=eval(join'*',1..5)-eval(join'+',1..9)-1; # 74 => J $_.=$".ord(chr($_+ord'+')); # 117 => u $_.=$".ord(chr($_+(eval(join('+',2<<4,2<<2,2)))-1));# 115 => s $_.=$".ord(chr($_+(eval(join('+',2<<4,2<<2,2))))); # 116 => t print map{chr}split; # Just print map{chr}32,65,110,111,116,104,101,114; # Another + print map{chr}32,80,101,114,108; # Perl print map{chr}32,72,97,99,107,101,114; # Hacker } # note eval join '+'(x..y) sums the joined numbers # eval join '*' (x..y) multiplies the joined numbers # $" is output record spearator default ' ' # Binary '<<' returns the value of its left argument shifted left # by the number of bits specified by the right argument. # thus dec 2 (b10) << dec 4 = b100000 = dec 32