use Errno; ... $select=new IO::Select(); $select->add(...); ... while (1) { $!=undef; while (@ready=$select->can_read()) { handle($_) foreach @ready; } die if $select->count() == 0; #should always have at least one last unless $! == EINTR; #try again; interrupted by signal } die if $! == ECHILD;