use IO::Handle; STDIN->blocking(0); # and try to read from it, like you would normally. my $line = ; if (defined $line) { # we have input, read succeeded } else { # no input at the moment. }