=over =item select FILEHANDLE X This calls the select(2) syscall with the bit masks specified, which can be constructed using C and C, along these lines: $rin = $win = $ein = ''; vec($rin, fileno(STDIN), 1) = 1; vec($win, fileno(STDOUT), 1) = 1; $ein = $rin | $win; If you want to select on many filehandles, you may wish to write a subroutine like this: sub fhbits { my @fhlist = @_; my $bits = ""; for my $fh (@fhlist) { vec($bits, fileno($fh), 1) = 1; } return $bits; } $rin = fhbits(*STDIN, *TTY, *MYSOCK); The usual idiom is: ($nfound,$timeleft) = select($rout=$rin, $wout=$win, $eout=$ein, $timeout); or to block until something becomes ready just do this $nfound = select($rout=$rin, $wout=$win, $eout=$ein, undef); Most systems do not bother to return anything useful in $timeleft, so calling select() in scalar context just returns $nfound. Any of the bit masks can also be undef. The timeout, if specified, is in seconds, which may be fractional. Note: not all implementations are capable of returning the $timeleft. If not, they always return $timeleft equal to the supplied $timeout. You can effect a sleep of 250 milliseconds this way: select(undef, undef, undef, 0.25); Note that whether C. On error, C, mostly because it does all the bit-mask work for you. B: One should not attempt to mix buffered I/O (like C or ) with C