This is my first attempt at Perl poetry. I translated
Machine Balerina from Suzanne Vega's Songs in Red and Gray into perl. It compiles and runs under strict, but it's pretty long, so please be patient.
# Machine Balerina
# By Suzanne Vega
# First, some definitions:
use strict;
our ($i_am, %you, $your, $we); # get these 'my' out of the way.
my $what = "thrown and received";
my $when = "on somebody's birthday";
my $whatfor = "for tease and delight";
sub soldier_of_tin {
my %position = @_;
while ($you{sit} eq 'royal') {
if ($position{standing} eq 'loyal') {
return "soldier of tin";
}else {return;}
}
}
sub your_phantasy_girl {
my $parts;
if ($parts = made_of($i_am, 'puzzling parts') and not $parts eq ('
+fits' or 'starts')
and $we =~ /wits/ and $we !~ /hearts/) {return "heard but neve
+r seen";}
else {return "phantasy girl";}
}
sub made_of {
my $material = shift;
if ($material =~ /parts$/) {
$material =~ s/\s*parts$//;
return $material;
}
}
# The ultimate question...
sub what_am_I {
if (($i_am eq "a thing on a a string to be $what $when $whatfor")
and print "goodnight" and print "goodby") {
return "an afternoon pastime";
} else {
my $retval;
for my $something (
"a toy on a tray",
"a soft piece of clay",
"qween or clown for the day",
"machine balerina",
soldier_of_tin(standing => 'loyal') )
{($retval = ("$i_am, " . &chorus)) if ($i_am eq $something) }
unless ($retval) {
for my $something (
"Mad Magazine",
"skin trampoline",
"pin-up pinball machine",
your_phantasy_girl )
{($retval = ("$i_am, " . &chorus)) if ($i_am eq $something
+) }
}
unless ($retval) {$retval = "your love";}
return $retval;
}
}
sub chorus {
for $your ("approval", "persual", "possible refusal") {
$i_am = "amusing";
$i_am = "a puppet for your play";
}
return $i_am;
}
OPTIMISTIC_RUN:
$we = "equal in wits";
$you{sit} = 'royal';
print "what am I to you? \n";
print what_am_I;
PESIMISTIC_RUN:
$i_am = "soldier of tin";
print "\n\nwhat am I to you? \n";
print what_am_I;
Update: fixed a typo. Thanks, Aristotle.