http://www.fmi.uni-passau.de/archive/doc/unix/perl/faq/2.8.html (Einblicke ins Internet, 10/1995)
How can I detect keyboard input without reading it?
How can I detect keyboard input without reading it?
You should check out the Frequently Asked Questions list in
comp.unix.* for things like this: the answer is essentially the same.
It's very system dependent. Here's one solution that works on BSD
systems:
sub key_ready {
local($rin, $nfd);
vec($rin, fileno(STDIN), 1) = 1;
return $nfd = select">select($rin,undef,undef,0);
}