This bit of code was inspired by a conversation in #macosx on efnet between several new (or soon-to-be) dads, all of which are CS majors. This was written to let them get the basic idea of what to expect :) (note: this is humorous and only mostly realistic). Code compiles.
#!/usr/bin/perl if (!%baby) { sleep $with_mate; } else { if ($baby{'age'} <= 1) { @actions = qw/Crying Sleeping Eating Pooping/; } if ($baby{'age'} == 2) { @actions = qw/Screaming Crying/; } if ( ($baby{'age'} >= 3) && ($baby{'age'} <= 12) ) { @actions = qw/Running Playing "Getting into Trouble"/; } if ( ($baby{'age'} >= 13) && ($baby{'age'} <= 15) ) { if ($baby{'gender'} eq "male") { @actions = qw/Eat Eat Eat Eat Eat Sleep/; } else { @actions = qw/Talk Talk Talk Shop Shop Sleep/; } } if ( ($baby{'age'} >= 16) && ($baby{'age'} <= 20) ) { @actions = qw/Flirt Flirt Flirt Flirt Flirt/; } if ( ($baby{'age'} >= 21) && ($baby{'age'} <= 95) ) { select MATE; fork; } if ($baby{'age'} > 95) { write WILL; bless %children; die; } }

In reply to Life, in Perl. by erasei

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.