npatel has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am a perl novice, and am embarking on creating a perl script for work. The following test loop does not break when I input nothing and then press 'return', it just keeps looping. Something wrong? I can't see an issue:
print "Hello How are you?\n"; print "Please enter your reply here: "; $count=0; while (defined(chomp(@input[$count]=<STDIN>))) { print "\nYour entry was \"@input[$count]\""; $count++; }
Any help greatly appreciated!
Npatel
20090323 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: While(defined(STDIN)) does not break
by Corion (Patriarch) on Mar 21, 2009 at 11:53 UTC | |
|
Re: While(defined(STDIN)) does not break
by johngg (Canon) on Mar 21, 2009 at 13:40 UTC | |
|
Re: While(defined(STDIN)) does not break
by CountZero (Bishop) on Mar 21, 2009 at 13:49 UTC | |
|
Re: While(defined(STDIN)) does not break
by Marshall (Canon) on Mar 22, 2009 at 21:10 UTC |