http://www.perlmonks.org?node_id=1020872


in reply to Reading Elements of an array in Parallel

I've been working with an almost similar issue and I decided to use threads to parallel process my data. This works fine when you don't have to end a thread after a time-out and start something else to get the same result. In this case I would simply wait for max. timeout for all commands to finish and then process what you have, report the jobs that didn't report back and simply exit the script. (thus freeing the resources.