JAPH

print "Just another Perl hacker,";

Assignment: Write a JAPH

A JAPH is a bit of code that prints "Just another Perl hacker," There is one at the install perl page. Check perlmonks for more.

Most of the time you want to write clear, readable code. JAPH's are just the opposite. You try to twist the thing as much as possible. JAPH's are one species of Perl obfuscated code, an art in itself.

For example, here is the letter "P", the hard way.

print chr 10*split/]/,"a]a]a]a]a]a]ab]c]" # I write this and looking back a year later, there is one thing I can't figure out. Thanks Mary.

Writing a "JAPH" is a rite of passage for a Perl Hacker. People will be in awe of you if you can write a good one.

This tutoral and "How to write unmaintainable code" are very helpful for ideas

Some ideas to get started

Some simple examples

Here I turn a list into a number, do some math on the number and turn it into a letter;

First step by step;

@_=qw(erk3 kerk3 k;;; er;er;; r;e e r; r;r; r;;) make a funky looking array, assigned to @_
$_=@_ $_ now contains a number, the number of items in the list @_ in this case, 9
print chr $_ * $_ -$_+2; multiply 9 x 9, subtract 7 (-9 + 2 = 7)

Now all together

@_=qw(erk3 k//rk3 k;;; er;er;;
r;e e r; r;r; r;;);$_=@_;print chr $_ * $_ -$_+2;

Even I can't decipher this mess. And this is only the first letter.