Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Answer: How can I validate user input?

( #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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2016-08-24 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (345 votes). Check out past polls.