http://qs321.pair.com?node_id=124876

tomazos has asked for the wisdom of the Perl Monks concerning the following question:

How do you perform a non-blocking read from standard input?

I want to write an interactive script that I am going to run from a command-line.

I want it to do things and read input keystrokes that may be present at the same time.

To do this, I believe the best way would be to setup a tight loop that alternated between testing if there are any characters on the input and going on with it's tasks at the same time.

In order to do that I would need a call (similar to the flock non-blocking flag) that would tell me if new input is present yet and return immediately if it is not.

Any ideas?