Looking at the following part of the code:

$min = int(rand(10)) + 15; $max = int(rand(25)); $dayofdeath = int(rand($max)) + $min;

You're first establishing a random maximum, and then taking a random value between zero and that first random number. This skews the day of death to lower values. I pulled this out and iterated it 2000 times and found the following number of deaths per day, starting from day 15:

44 53 66 106 116 127 128 134 145 173 133 104 90 76 67 69 55 56 50 41 30 26 21 29 24 8 13 8 5 1 2 1

This may be construed as a feature :)

The following block (and similar blocks):

print "DAY: $days\n"; print "================\n"; print "LICE: $n\n"; print "LIVE LICE: $living\n"; print "DEAD LICE: $deathtoll\n"; print "FEMALES: $females\n"; print "MALES: $males\n"; print "EGG LAYERS (FEMALE ADULTS): $egglayers\n"; print "NYMPHS (LITTLE/YOUNG): $toddlers\n"; print "EGGS: $eggsacks\n"; print "EGGS LAID TODAY: $eggslaidtoday\n"; print "================\n";

... can be written less noisily using a heredoc:

print <<END_OF_REPORT; DAY: $days ================ LICE: $n LIVE LICE: $living DEAD LICE: $deathtoll FEMALES: $females MALES: $males EGG LAYERS (FEMALE ADULTS): $egglayers NYMPHS (LITTLE/YOUNG): $toddlers EGGS: $eggsacks EGGS LAID TODAY: $eggslaidtoday ================ END_OF_REPORT

Off topic information on lice removal below the fold:

My own kids have caught lice at school on a couple of occasions, and I sympathise with you. We used a couple of nasty Agent Orange-like products to get rid of them, but the critters are developing resistance to them and thus they become less effective, and the doses stronger.

During the last infestation our pharmacist told us of a new product with is basically a liquid silicon gel, and as it dries out it suffocates the lice. In other words, a mechanical process rather than insecticidal, and thus nothing the bugs can evolve defenses against. And much less aggressive on a young child's scalp.

• another intruder with the mooring in the heart of the Perl


In reply to Re: Simulate a head lice infection by grinder
in thread Simulate a head lice infection by Anonymous Monk

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.