in reply to Re^2: Nicest way of getting STDIN a beauty contest
in thread Nicest way of getting STDIN a beauty contest
It will wait in perpetuity before exiting if no input was provided to STDIN and no file was specified.
How long do you want it to wait? Your program has to wait until I'm done with the current line. How does it tell that I've not just gone away for a coffee break?
However, if STDIN is closed (e.g. by typing ^D at a terminal, or by closing a pipe after no input) the simple solution
chomp( my @hosts = <>); die "usage: foo hosts\n" unless @hosts;
will do what you want.
|
|---|