in reply to Re: Forkin around
in thread Forkin around

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.