Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: STDIN Enter key not quite working

by choroba (Cardinal)
on Apr 05, 2021 at 19:59 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11130859]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-24 22:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found