my $wait = 12; #wait up to 1 minute
while ( $kids > 0 && $wait-- ) {
warn "waiting for $kids children to terminate";
sleep 5;
my $wait = 12; #wait up to 1 minute
while ( $kids > 0 && $wait-- ) {
warn "waiting for $kids children to terminate";
sleep 5;