in reply to how to get pid for multiple child process in parent process

Just save the pids as you generate them:
my @pids; for loop { $pid = fork(); if ($pid) { # if parent push(@pids, $pid); } else { # if child ... exit; } } # only parent reaches this point kill 9, @pids; # perform mass filicide
or... have waitpid() tell you what they are:
use POSIX qw(:syswait_h); while ((my $pid = waitpid(-1, WNOHANG)) != -1) { kill 9, $pid; }