# Create the list of filedescriptors to check for activity $bits = $bobs = ''; foreach my $listen (@listeners) { vec($bits, $listen->{fd}->fileno(), 1) = 1; } # Do the business my ($rout, $wout, $eout); my $nfound = select($rout=$bits, $wout='', $eout='', undef); # Get our noses rubbed in it foreach my $listen (@listeners) { my $fn = $listen->{fd}->fileno(); # Check if this filedescriptor has data waiting if (vec($rout, $fn, 1)) { # This filedescriptor ($listen) is ready for # reading (or has been closed at the remote # end) } }