http://qs321.pair.com?node_id=968912


in reply to Fork multi processes

How can I achieve it using Perl?
The same as in C. In a nutshell: fork, fork, fork, fork, fork, wait, fork. That is, you fork of 5 children, then wait for any of them to finish, after which you fork the 6th.

Of course, you shouldn't ignore SIGCHLD, and you may need to do some more bookkeeping if you do other forks as well.