Ok,

So I've got a real simple script that takes a list of hosts, pings them (Net::Ping), checks to make sure we have at least X number of active machines (if we don't, something is severly wrong), and then does something else. For the record, this is ActivePerl 5.8.3 on a Wintel box.

So the code, like I said, is simple (summary below):

print "Doing some work ..."; &doSomWork(); print "Done\n"; print "Doing some ping ..."; &doSomePing(); print "Done\n"; print "Checking threshold ..."; if ($yadayadaya < $yodolodolo) { die "Horrible death"; } Print "Done\n";
That's it in a nutshell. Now check out the output and notice where the "Checking threshold" line actually comes in:
C:\temp>myScript.pl Doing some work --> Done. Doing some ping --> Done. Doing something else --> Done. Number of machines to be LAPC'd (178) below threshhold (700), please i +nvestigate ! at I:\perl\lapc.pl line 41. Checking Threshold --> C:\temp>
The script does what it's supposed to and works fine, but I've noticed this before in other scripts and it seems like either a buffer isn't flushing or perl is just flatout deciding to rebel against the humans and work the code in it's own order.

Bill in Brooklyn


In reply to print command buffer by Bill in Brooklyn

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.