On Jul 29, 2004, at 9:23 AM, BOLCATO CHRIS (esm1cmb) wrote:
This may be a dumb question, but why will this loop not end when nothing is
entered in STDIN?
STDIN is a stream. A blank line does not constitute the end of a stream. I believe your can signal an end to the stream in most terminals with control-d.
If we want to check for blank lines, we can do that...
print "Enter Things:\n"; while (<STDIN>) {
chomp; # to remove the newline character at the end last unless length $_; # end when we see nothing
print "I saw $_";
print "I saw $_\n"; # update to add newline
} print "The End\n";
Hope that helps.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>