my $rip_done = 0; $SIG{CHLD} = sub { $rip_done = 1; while( waitpid(-1, WNOHANG) > 0) {} }; #### if($rip_done == 1) { do some stuff }