# Create Socket my $socket = IO::Socket:UNIX->new([...]); [...] # Prepare bitvector of filedescriptors to poll my $readable = ''; vec($readable, $socket->fileno, 1) = 1; # Wait up to one second for incoming data given (select($readable, undef, undef, 1.0)) { when (1) { # There is incoming data, so read it $socket->recv([...]); } when (0) { # The call timed out [...] } when (-1) { # There was an error warn "Error waiting for incoming packets: $!"; } }