slugger415 has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, probably a dumb question, but I am using <STDIN> to collect user information on a Perl script on Mac OSX. For some reason pressing Enter moves the cursor to the next line, and only by pressing control-D can I get it to continue. And control-D by itself doesn't do it either. Naturally I'd like the Enter key to be the only thing needed. Am I doing something wrong?
#!/usr/bin/perl print "How many cookies do you want? Enter number: "; my($cookies) = <STDIN>; chomp($cookies); print "You wanted only $cookies?\n";
Thanks -
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: STDIN Enter key not quite working
by choroba (Cardinal) on Apr 05, 2021 at 19:59 UTC | |
by slugger415 (Monk) on Apr 05, 2021 at 21:24 UTC | |
Re: STDIN Enter key not quite working
by Fletch (Bishop) on Apr 05, 2021 at 21:58 UTC | |
by Marshall (Canon) on Apr 05, 2021 at 23:53 UTC |