You know, I could have done something productive with my time tonight... To my credit, I was able to stop this silliness before I finished Perl-ing the whole song.
use Person; use Bar qw/:smoky/; my $piano_man = Person->new( name => 'Billy Joel' ); ### it's 9:00 on a Saturday. a regular crowd shuffles in my @crowd = (); if ( (localtime time)[2] == 21 and (localtime time)[6] == 6) ) { splice(@crowd, rand(@crowd), 0, Person->new) for (1 .. $regular); } ### there's an old man sitting next to me, making love to his tonic an +d gin. my $mypos = $piano_man->position_in(@crowd); my $old_man = Person->new( gender => 'M', position => 'sitting', age = +> 70, figurative_sexual_partners => [ $tonic, $gi +n ] ); splice(@crowd, $mypos+1, 0, $old_man); # .. insert the rest of verse one here ... my @us = @crowd[ 0 .. ($mypos-1), ($mypos+1) .. $#crowd ]; ### sing us a song, you're the piano man. sing us a song tonight ((localtime time)[2] > 18) and $piano_man->sing( $songs[rand(@songs)], @us ); ### well, we're all in the mood for a melody and you've got us feeling + alright. my $alright = ($bad + $good)/2; for (@us) { $_->set_mood_flag(1 << MELODY); $_->feel_emotion($alright); }
My favorite part is the "shuffles in" part -- I'm not familiar with the "real" array shuffling algorithms, but this is random enough for me.

blokhead


In reply to Piano Man by blokhead

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.