if i ran the script with 10 threads i would get about 4-7 threads that would hang.
Quite possibly symptoms of the same problem on a multi-cpu system rather than my single cpu system?
You could try addressing the issue that moritz raised, by changing your loop to:
And see if that helps any. If not, try generating a standalone demo of the problem (using ping) and post a perlbug report. Maybe whomever there fixed the problem for 5.10 will recognise the symptom and be able to offer a patch against 5.8.8?
Beyond that, I can't see any way of avoiding the bug, as it also affects piped opens. The alternative might be to use NET::SNMP to do whatever the executable your using is doing. Perhaps too painful to reproduce?
One thing that route does have going for it is a non-blocking mode that appears to work quite well, which mean that you could avoid using threads altogether.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.