Mariola has asked for the wisdom of the Perl Monks concerning the following question:
# Title, needs to be Dr, Lady, Lord, Miss, Mr, Mrs, Ms or Sir $conditionTitle = 0; do { print("Please enter your title: "); chomp($title = <STDIN>); if($title =~ /^Dr|Lady|Lord|Miss|Mr|Mrs|Ms|Sir|$/) { print("Thank you.\n"); $conditionTitle = 1; } else { print("The allowed titles are: Dr, Lady, Lord, Miss, Mr, Mrs, Ms o +r Sir."); } } while($conditionTitle == 0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Silly question about regular expressions
by Corion (Patriarch) on Jun 23, 2006 at 13:30 UTC | |
by Mariola (Initiate) on Jun 25, 2006 at 11:49 UTC | |
|
Re: Silly question about regular expressions
by cdarke (Prior) on Jun 23, 2006 at 13:33 UTC | |
|
Re: Silly question about regular expressions
by prasadbabu (Prior) on Jun 23, 2006 at 14:15 UTC |