Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 23:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found