in reply to Re: Nicest way of getting STDIN a beauty contest
in thread Nicest way of getting STDIN a beauty contest

It's a nice approach but it still doesn't bail when you simply type...
do_something

It will then wait for input until you do CTRL+D. In the first example it will exit immediately if nothing is available in STDIN.

But doing that either involves using "select" or "IO::Select". Using either if those the solution quickly becomes quite ugly for a quite simple thing.