Hello again,
I wrote it exactly as you did. In fact i copied and pasted this code just to be sure. I still had dead children that the handler was unable to handle because they died exactly when the handler code was occupied with another child.
Since i dont care about the pids of the dead processes i tried using wait() and i got it to work. The code looks like:
while (($openforks > 0) && (wait()))
{
$openforks--;
spawn(\@jobs);
print "somebody died\n";
}
In all the tests i ran, i reap the exact number of jobs that i spawned.
Thanks for all the help though :)
George