@JAPH[0]

I like Perl JAPHs. If you don't know what a JAPH is, the answer is only a google away. Not even a full google. More like half a google.
In this ongoing series, I'll be deconstructing JAPHs. I'm no Perl monk, so I'm starting simple and working up. After all, the best way to learn is to teach (unless you know absolutely nothing, of course...)

$_ = "wftedskaebjgdpjgidbsmnjgc";
tr/a-z/oh, turtleneck Phrase Jar!/; print;

The first line defines the default variable $_ as a string of gibberish. But we can see immediately that the string has 25 characters - the same number as Just another Perl Hacker,. So we can safely assume that some operation will be performed on this string that transforms it into the well-known JAPH.
The second line uses the transliteration operator?, which, like many operators, operates on $_ by default. The transliteration operator essentially remaps letters. In this context, a-z specifies a range of characters, so the entire alphabet is being remapped.

original: abcdefghijklmnopqrstuvwxyz
remapped: oh, turtleneck Phrase Jar!

So all instances of a in $_ will be replaced by o, b will be replaced by h, and so on. Note that our gibberish string doesn't use y or z, so a-w would work just as well. The result of the transliteration is, of course, Just another Perl hacker,, which is subsequently printed (yes, print will also operate on $_ by default).

That was pretty long-winded for just two lines, but JAPHs are usually designed to be difficult to understand. That's what makes them so interesting!

Leave a Reply

Theme: Esquire by Matthew Buchanan.