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*oU@{$/=$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 five Obfuscated Perl contests. The entries are all available on this book’s web site at www.oreilly.com/catalog/tpj3.

Back in 1996, I asked a certain computer book publisher if they wanted to sponsor the contest. They refused, citing that the contest sent the wrong message about Perl.

I can’t really blame them, since the contest unabashedly contributes to the reputation Perl had many years ago as a “write-once” language. But true hackers revel in such perverse pleasures, whether the medium of expression is LEGOs, wordplay, the diagram of a Rube Goldberg contraption, or source code. Besides, if Perl didn’t allow you to create monstrosities, it wouldn’t allow you to create masterpieces either.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset