Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1044630]
help
Chatterbox?
[Lotus1]: damn, I just opened the attacment on a phishing simulation email in the $work email
[Lotus1]: now I'll be sent to re-education camp or something
[stevieb]: relocate Lotus1 to the brig, straight away!
[erix]: let's do an education simulation

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (14)
As of 2017-05-24 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?