in reply to Parsing answer for a 'yes'
If you're going to demand the string be "yes" or "y", there's no need to use a regex. Just test for string equality: if ($question eq 'yes' || $question eq 'y') ... Possibly that's what got you confused about using the two vertical bars instead of one.
On the other hand, if you're going to be liberal in what the program accepts, then a regex works great. But you can make it simpler: if ($question =~ /^y/i) ...That will accept "yes", "y", "yeah", "yep", and "yoohoo!" (and their uppercase counterparts ;-).
HTH
|
|---|