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.


In reply to Machine Balerina / Suzanne Vega by yosefm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.