Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: comparison of character

by davido (Archbishop)
on Jul 16, 2013 at 15:57 UTC ( #1044630=note: print w/ replies, xml ) Need Help??


in reply to comparison of character

If it's homework, by all means, figure out the logic. If not:

use IO::Prompt::Hooked; my $choice = prompt( message => 'Do you wish to update? (Y/N):', validate => qr/^[YN]$/i, );

Or if you want to provide extra help upon receiving invalid input:

my $choice = prompt( message => 'Do you wish to update? (Y/N):', validate => qr/^[YN]$/i, error => "Response must be 'Y' or 'N'.\n\n", );

...or if you want to add a default...

my $choice = prompt( message => 'Do you wish to update? (Y/N):', default => 'N', validate => qr/^[YN]$/i, error => "Response must be 'Y' or 'N'.\n\n", );

Dave


Comment on Re: comparison of character
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1044630]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-12-27 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls