Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 scrutinizing the Monastery: (11)
As of 2015-07-06 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (74 votes), past polls