use Term::ReadKey; for (;;) { if (defined(my $c = ReadKey(-1))) { # got a character $c, process } # do other stuff }