in reply to default value after timeout

You may want to look at IO::Select. Here is an excerpt from the perldoc:
NAME IO::Select - OO interface to the select system call SYNOPSIS use IO::Select; $s = IO::Select->new(); $s->add(\*STDIN); $s->add($some_handle); @ready = $s->can_read($timeout); @ready = IO::Select->new(@handles)->read(0);