STDIN Question

H

Hobbit HK

I know that if I do:
$line=<STDIN>;

I'll read from STDIN until I'll press ENTER... My question is, how can
I change it? I mean, can I do that if I'll press, for example, "c"
it'll stop reading from STDIN? or, alternatively, can I do that it'll
stop reading after 2 chars?
 
D

David Efflandt

I know that if I do:
$line=<STDIN>;

I'll read from STDIN until I'll press ENTER... My question is, how can
I change it? I mean, can I do that if I'll press, for example, "c"
it'll stop reading from STDIN? or, alternatively, can I do that it'll
stop reading after 2 chars?

perldoc -q key

I do know if those methods display each key pressed or leave it up to you
to echo them to the screen (with output buffering disabled and print
without newline, although, you may need a newline after accepting last
input).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top