Perl Operators   «Prev  Next»

Pattern Matching Operator - Exercise

Using the pattern-matching operators


Objective: Write a program that uses the pattern-matching operators with a yes/no question.

Instructions

Write a program that asks the user a yes-or-no question. If the answer is yes, give one response; if the answer is no, give another; if the answer is neither yes nor no, give yet a third response.
Use the pattern-matching operator to test for yes and no. Allow responses in any combination of case; that is, Yes, yes, or yEs are all acceptable.
Paste your program code into the text area below and click the Submit button to submit your answer.