Part VII. Obfuscated Perl

When I began TPJ, I knew that hosting an Obfuscated Perl contest was a must. Soon after launching the magazine, Felix Gallo volunteered to author the announcements and results, and his twisted eloquence hit the mark perfectly. The contests challenged the Perl community to generate programs so contorted that the judges (Felix and I) couldn’t deduce how they worked. Some of the entries were surprisingly educational and useful, most were grotesquely humorous, and a few became the firstever publication of Perl’s most obscure nooks and crannies.

The notion of squeezing a program into the smallest space available isn’t as frivolous as it might seem. Computational theorists sometimes measure the complexity of an algorithm by how concisely it can be expressed; the briefer the program, the simpler the algorithm. Brevity can have political implications as well—consider the old furor over the legality of exporting the RSA cryptosystem, which has been implemented in successively tinier Perl programs, culminating in this two-line obfuscated masterpiece by Adam Back and others:

print pack"C*",split/\D+/,'echo "16iII*o\U@{$/=$z;[(pop,pop,unpack"H*",<>
)]}\EsMsKsN0[lN*1lK[d2%Sa2/d0<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<J]dsJxp"|dc'

Variants have appeared in signature files, and on T-shirts, bumper stickers, and two forearms and a chest (as tattoos).

This section contains the announcements and results of all ...

Get Games, Diversions & Perl Culture now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.