Why not just push @children, $pid after every fork, then use scalar @children to get the count? I feel like I must be missing something here, and that's entirely possible.
---
It's all fine and dandy until someone has to look at the code.
Comment on Re: Controlling number of processes Forked