That's exactly what was blowing my mind. I could not comprehend how the 'print BAD "$_ : NOT A VALID IP ADDRESS\n";' was being executed over and over again for each child process that was being spawned. If I took the 'BAD' filehandle out and just let the print go to STDOUT I only got one iteration to my screen, but the moment I tried to print it to the BAD FH I kept getting multiple instances of the same data from the children.

At first I assumed that the reason I did not see multiples when printing to STDOUT was that STDOUT was disasociated in the children. That conclusion was incorrect.

It turns out that each child process was indeed sending the data to the output file attached to 'BAD'. But not in any way that was immediately apperent to me. What was happening was that I did not turn on autoflushing for those FH's. When the children recieved dupes of the open FH's and then closed, the FH's were flushed. So, essentially each child was flushing the FH and the output went were it was supposed to, the file.

I added autoflush for each output FH and the problem went away. I just popped in here to update this when I saw your response.

Thanks for your input though, I was starting to wonder why I had no response.


In reply to Re: Re: Forkin around by gnu@perl
in thread Forkin around by gnu@perl

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.