Perl Operators   «Prev  Next»

Conditional Operators - Exercise

Using Conditional Operators

Objective: Write a Perl program that asks the user a yes-or-no question.

Instructions

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.
You can use either the ternary operator or, if you are familiar with them, the if, elsif, else statements.
Paste your program code into the text area below and click the Submit button when you are finished.