Re: Fetching input character without newline?
- From: anno4000@xxxxxxxxxxxxxxxxxxxxxx
- Date: 19 Nov 2006 22:32:40 GMT
Mark <anon40629@xxxxxxxxxxx> wrote in comp.lang.perl.misc:
Good afternoon.
I am attempting to solicit user input using the following:
while ()
{
print "Enter your response here (1-5): ";
$ret = <STDIN>;
if ($ret =~ /^([1-5])$/)
{print "\nUser chose $1\n";
last;
}
}
This code reprints the prompt string on the next line each time
the user responds incorrectly. I would _like_ to handle an incorrect
response by erasing the user's entry and leaving the prompt in place
on the current line.
Any suggestions on how to do this?
perldoc -q 'single character'
Anno
.
- Follow-Ups:
- References:
- Fetching input character without newline?
- From: Mark
- Fetching input character without newline?
- Prev by Date: Re: Do I *have* to use 'OOP' to use modules?
- Next by Date: Re: Do I *have* to use 'OOP' to use modules?
- Previous by thread: Fetching input character without newline?
- Next by thread: Re: Fetching input character without newline?
- Index(es):
Relevant Pages
|