|No such thing as a small change|
Unable to reuse STDINby fireblood (Scribe)
|on Jul 04, 2016 at 02:04 UTC||Need Help??|
fireblood has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I'm trying to use STDIN first to read from the output of the previous process and then to read from the terminal. According to http://perldoc.perl.org/perlop.html#I%2fO-Operators I should be able to do this:
"The <> symbol will return undef for end-of-file only once. If you call it again after this, it will assume you are processing another @ARGV list, and if you haven't set @ARGV , will read input from STDIN."
That's what I need! My simplified program, called pgm, is the following:
and I invoke it as follows:echo Hello | pgm
But it doesn't wait for anything to be entered at the <>:
Wouldn't the while (<STDIN>) end because it encountered EOF, after which it should then read input from STDIN?