Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: STDIN Enter key not quite working

by choroba (Archbishop)
on Apr 05, 2021 at 19:59 UTC ( #11130859=note: print w/replies, xml ) Need Help??


in reply to STDIN Enter key not quite working

my($cookies) = <STDIN>;

By wrapping $cookies into parentheses, you're forcing list context. <STDIN> in list context reads up to the end of file. Ctrl+D sends the end of line.

If you just want to read a single line, don't use parentheses.

my $cookies = <STDIN>;

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: STDIN Enter key not quite working
by slugger415 (Monk) on Apr 05, 2021 at 21:24 UTC

    Aha! thank you!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11130859]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2021-05-13 19:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (142 votes). Check out past polls.

    Notices?