$forkcount -= waitpid(-1, WNOHANG) > 0 while $forkcount >= $maxforks; #### wait, $forkcount-- while $forkcount >= $maxforks;