my $nfound = select($rout = $rin, $wout = $win, undef, undef); # Check $nfound for errors. if(vec($rout, fileno SIGRD, 1)) { my $byte; while(sysread(SIGRD, $byte, 1)) { if($term) { # INT/TERM arrived, kill sshs, modify some data, ... $term = 0; } else { # CHLD arrived, do waitpid(), modify some data, ... } }