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

Answer: How can I validate user input?

by ton (Friar)
on Apr 05, 2001 at 03:56 UTC ( #69947=categorized answer: print w/replies, xml ) Need Help??

Q&A > input and output > How can I validate user input? - Answer contributed by ton

while ($start !~ /^[0-7]$/) { print "Please Enter the Start-Level (0-7,?)[0]: "; $start = <STDIN>; chomp $start; if ($start eq '?') { print "Some help info.\n"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2016-12-07 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (128 votes). Check out past polls.