use IO::Select; my $s = IO::Select->new(\*STDIN); while (1) { if ($s->can_read(1)) { my $foo = ; } }