for loop { $pid=fork; exec (command); } if ($pid > 0) { # I am in the parent process kill child pid; # How to do for multiple child processes? }