in reply to Uninitialized value in numeric eq (==) after 65 iteration of a loop using fork?!?

I've never used fork before, so I tried your code to see if I could learn something. I got the same errors as the rest of you, failing after 65 lines (printing 99 to 35).

But if I add either of the following before the child if statement

if(!defined $pid){ die "$runs: $!"; } OR if(!defined $pid){ print FILE "undefined at $runs\n"; $runs--; next; }

it only prints 64 times (99 to 36). Actually, that's what I would expect.

Why do we get an error on the if ($pid == 0) { line, but then it still goes and prints one more time?

I also find it interesting that when I use my second if statement above, it prints down to 37, then all the undefined lines; and then it prints 36. Is there something significant about that?

TheEnigma