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);
        }