Blog | RSS | Photo Gallery | Wish List     Eric's Blob
The Jabberwock Returns Posted at 14:41 by Eric

Back in 2001, I was amazed to learn that I had won second place in the Perl poetry contest for my submission of Jabberwocky. It was published in SysAdmin Magazine (which, at that point, was also The Perl Journal). That was really cool, but it had slowly slipped my mind over the years.

It recently jumped out at me when I received an email from Susanne, a student at The Free University of Berlin. She's working on her master thesis in comparative literature. Her thesis is on, well, code poetry. And Jabberwocky is one of the three poems she's analyzing. She knows some coding, but not Perl. So she wanted a hand in deciphering what it was that I had written.

I was happy to help out. I was curious how she had run across Jabberwocky, so I poked around on Google a bit to see what references there were to it. She had seen it on Perlmonks. But I was astonished to find this flattering review of Jabberwocky, along with a reference to it in this Wiki.

Wow. I was really thrown off by all this. I'm surprised people understood it, much less enjoyed it :-) It was my first attempt at Perl poetry, and there's a number of things I'd consider changing about it, which is probably why I have trouble with all this attention :-)

You can read it at one of the links above, see below for my commentary that I sent to Susanne. Be warned that the explanation is for someone who really doesn't know Perl well, and takes away from the flow, and any cleverness that it may have... it's like trying to explain a sunset, it's much better to just watch it :-)


Jabberwocky overexplained

# $toves{slithy} is an associative array (hash).  It executes if $brillig
# is true
$brillig and $toves{slithy};

# @wabe is an array.  This line has two "for" statements, each of which
# loop over the array, and sets the array contents to $gyre and $gimble.
for $gyre ( @wabe ) {} for $gimble ( @wabe ) {}

# map loops over the @borogoves array.  The code "s/^.*$/mimsy/g" is a
# regular expression, changing the contents of each item in @borogoves to
# "mimsy"
map { s/^.*$/mimsy/g } @borogoves

# This simply sets the hash $mome{raths} to be "outgrabe"
and $mome{raths} = outgrabe;


# Here is where the first process is spun off.  The "fork" statement
# begins the new process.  If $son is true, that means we're in the parent
# process, and the code in the following curly braces will be executed
# (which is the person (father?) warning the boy about the Jabberwock.

# "warn" is a Perl command which outputs text as an error, as opposed to
# regular output
if(my $son = fork) { warn "Beware the Jabberwock!";

# Runs "bite" if "jaws" is true, runs "catch" if "claws" is true.  Since
# they are written as constants, and not variables, they will always be
# true.
jaws && bite, claws && catch;

# Another "warn" statement
warn "Beware the Jubjub bird" and $shun,

# The "else" at the end of this line is the end of what the parent process
# does at the moment
$Bandersnatch{frumious} == 1; }else{

# This next stanza is executed by the child process.

# This line is meant to be a bit "clever".  In Perl, the variable $_ is
# special, and always contains the value of the last operation.  It's kind
# of like a pronoun.  So, using "$_" is a bit like saying "he" or "it".
# Secondly, the \ in the statement means to pass by reference and not by
# value.  That is, it doesn't make a copy of the value, but it hands over
# the real thing.  So, it's like he's really picking up the vorpal sword.
$_{hand} = \$sword{vorpal};

# "seek" looks for something within a file.  FOE is the file it's looking
# through.  The number "4_294_967_296" is really "4,294,967,296", as Perl
# doesn't like comma's.  In languages like Java and C, you have to define
# variables as a certain type before you use them.  For example, "short",
# "int", "long", etc, which are all types of integers.  The value
# "4_294_967_296" is the length, in bits, of a "long" integer.  Get it?
# 4_294_967_296 * time, "long time"? :-)
seek FOE, $manxome, (4_294_967_296 * time);

# tells the process  to go to "sleep" for a certain period of time
sleep ($tree{Tumtum} = $_);

# There's actually a Perl command called "study".  This executes "stand"
# as long as "study" is true.
while (study) { stand }


# Shows that $_{stand} is true as long as study{$uffish} is true
while (study($uffish)) { $_{stand} == 1; }

# Create the Jabberwock process here.  "unless" is the opposite of "if".
# Using "unless" is the same as saying "if not".  The following code is
# executed as long as it's being read in the Jabberwock process.
unless ($Jabberwock = fork) { $Jabberwock{eyes} = flame,
$Jabberwock{movement} = wiffle, $Jabberwock{location} = $wood{tulgey};
while ($coming=1) { burble }}

# Now we're back to the "$son" process (the extra "}" at the end of the
# line above ended the Jabberwock process)
(1, 2), (1, 2) and through and through;
$sword{vorpal}{blade} = snicker-snack;

# The "kill" command is actually for killing a process, and "9" says to do
# it "harshly", so to speak.  So the following kills the process named in
# $Jabberwock.  Running "chop" removes the last character from a string.
(kill 9, $Jabberwock), $head = (chop $Jabberwock);

# This is a small subroutine, which returns $_ (he) and $head (the
# Jabberwock's head)
sub{ return $_, $head }; }


# We're back to the parent process now
tell $son, "And hast thou slain the Jabberwock?".
"Come to my arms, my beamish boy! ".
"O frabjous day! Callooh! Callay! ",
$_{joy} = chortle if $son;

$brillig and $toves{slithy};
for $gyre ( @wabe ) {} for $gimble ( @wabe ) {}
map { s/^.*$/mimsy/g } @borogoves
and $mome{raths} = outgrabe;

| |

Post a Comment
    Name:
    URL/Email: [http://... or mailto:you@wherever] (optional)
    Title: (optional)
    Comments:
      Use HTML for formatting. Allowed HTML: <a> <p> <b> <i> <u> <hr> <br> <ol> <ul> <li>

trackback

TrackBack ping me at:

http://www.openthought.org/blosxom.cgi/Blog/Computers/Programming/Perl/jabberwocky.trackback