Clear questions and runnable code
get the best and fastest answer
The Lighter Side of Perl Culture (Part V): Poetryby eyepopslikeamosquito (Bishop)
|on Apr 25, 2005 at 14:10 UTC||Need Help??|
28th March 1990: You are sitting at your workstation inside the most advanced aerospace agency on Earth. Concentrating, intensely concentrating, busy designing the most advanced postmodern programming language on Earth. But wait, what's that noise? A poetry reading? In the next cubicle? You must be joking! No ... clear as a bell, you hear:
I'd travel to the ends of time
Startled, and startling your co-workers, you shout your defiant response through cupped hands over the cubicle wall:
I've taken the trash out innumerable times,
Though I doubt it happened exactly like that, just three days after this historic rec.arts.poems sharon-larry-esque exchange, in what formed the most celebrated April Fools joke in Perl history, a bizarre request to create a new comp.lang.perl.poems newsgroup appeared, supposedly sent by Larry Wall and doubtless egged on from the next cubicle.
There is little doubt that the whole Perl poetry movement sparked from this single chance event. Had Larry and gifted poet Sharon Hopkins not been working together at JPL would Perl poetry exist today?
The quotes above reaffirm Perl as the premier computer language for writing poetry -- and indeed perhaps the only computer language in history where the ability to compose poems actually affected its design.
This, the fifth episode of the long running series on the lighter side of Perl culture, focuses on Perl Poetry.
Why is Perl a Good Language for Writing Poetry?
The key point from the quotes above is that, in the spirit of freedom and TMTOWTDI, Perl allows you to write poetry without forcing you to do so.
Perhaps the primary reason why Perl is so well suited to writing poetry is simply that it was designed, not by a computer scientist like most computer languages, but by a linguist. Curiously, Larry attended linguistics graduate school at U.C.Berkeley at around the same time as Bill Joy and his BSD cohorts attended computer science graduate school there. As far as I'm aware, they did not write any poems together while at Berkeley.
Perl's poetry support was further strengthened by the chance circumstance of an enthusiastic and innovative poet, namely the reigning Perl poetry pump-queen Sharon Hopkins, sitting right next to Larry at JPL during Perl's formative years. Newsgroup messages suggest that Larry moved from JPL to netlabs in July 1991, and that Sharon followed him there about one year later.
What Makes a Good Perl Poem?
There is little difference between a good conventional poem and a good Perl one; it's just that the Perl poem must satisfy an additional constraint of compiling (and optionally running) without error.
As you might expect, it is much harder to write a Perl poem that actually runs without error. So much so that most Perl poets satisfy themselves with poems that merely pass perl -c.
For more details on this subject, including examples that poetically produce text output when run, thus extending the theme developed within the poem's source code, see Sharon Hopkins' definitive work: Camels and Needles.
In 1962, the French Oulipo movement proposed the idea of poetry written in programming languages. As described here, however, it took ten years before anyone actually did it, the first poems being penned by Le Lionnais and Noel Arnaud in the Algol programming language in the early 1970s.
Though history.perl.org credits Larry Wall with writing the first Perl poem in March 1990:
Sharon Hopkins and merlyn should perhaps share the glory (or blame, depending on your point of view :-) -- merlyn for inventing the JAPH, Sharon for suggesting that Larry write a JAPH in the form of a haiku. Notice that, when read aloud with canonical Perl poetic pronunciation, namely:
this poem does indeed qualify as a haiku (5-7-5 syllables). Notice too that this Perl 3 code no longer runs with modern perls.
Sharon Hopkins hosted the first First Perl Poetry Contest in August 1991. This contest was won by Dr. Craig Allen Counterman, Ph.D, with a rollicking rhyme, "Time to Party". Alas, the contest could hardly be called a success because this was the only entry received and, by the author's own admission, was less inspired than his more scholarly earlier work "Ode to my Thesis". Both of Craig's poems can be found in Camels and Needles.
Numerous Perl poetry contests have been run since then by Kevin Meltzer of The Perl Journal, by TPC, and by ActiveState. There was even one run here at Perl Monks: Aaah, spring (A Very Special Perlmonks Contest). See the References section below for links.
Haiku and Coy
Damian Conway's prize-winning Coy module caused a sensation when it debuted in 1999. Essentially a drop-in replacement for Carp, the module itself is quite sophisticated, featuring an extensible data-driven poem generator. The entire Coy module documentation is written in haiku; here is the module description:
Some Classic Poems
These come with the usual caveat that there are many Perl poems I've never seen, so if you know of a good one, please let us know!
References Added Later
Other Articles in This Series