use IO::Select; # loop every 1 second my $timeout = 1; my $s = IO::Select->new(); $s->add(\*STDIN); while ( 1 ) { if ( my @ready = $s->can_read($timeout) ) { # we got input for my $fh ( @ready ) { my $input = <$fh>; print "got: $input"; } } else { # no input } # just to show that we're looping print scalar localtime; } #### my $input; sysread( $fh, $input, 1024);