$SIG{INT}=\&myhand; print "Parent pid = $$ \n"; $pid = open(CMD, "ping google.com -n 15 |"); print "Ping running... pid = $pid \n\n"; # uncommenting this line breaks ability to SIGINT #print ; # keep the script running; only the SIGINT will exit while (1){sleep 1}; sub myhand() { print "Parent $$ caught SIGINT.\n"; print "Parent $$ will KILL $pid.\n"; kill 9, $pid; exit(0); } #### #parent if ($forkpid = fork) { local $SIG{INT} = sub { print "i'm quitting"; kill 9, $pid; exit; }; waitpid($forkpid, 0); #child } else { die "cannot fork: $!" unless defined $forkpid; $SIG{INT} = sub { print "i'm quitting child"; close(CMD); kill 9, $pid; exit; }; $pid = open(CMD, "ping google.com -n 15 |"); # exec ("ping google.com -n 15") or die "Can't exec: $!\n"; } print "Done with fork. Here are my results:"; print ;