JavaDeploy
SiteMap
Perl 1
Perl 2
ASP
XML
Perl Operators
«Prev
Next»
Perl Intro
Perl Course
Obtaining web Perl
Installing Perl
Learning Perl
Perl History
Perl Language
General Syntax Structure
Perl Comments
Working with Testbed
Perl Conclusion
Perl Variables
Scalar Types
Scalar Variable Syntax
Perl Scalar Context
Numeric Strings Literals (L5)
Perl Lists
Perl Arrays (L7)
Accessing Array Members
Perl Array Subscripts
Perl Stack Array
Shift Unshift
Perl Join Function
Split Function
Perl Hash Functions
Perl Hash Index
Perl Operators
Terms Operators Expressions
Operator Precedence
Perl Math Operators
Perl String Operators
Increment Decrement
Boolean Relational
Match Operator
Substitute Operator
Translation Operator
Pattern Matching Variable
File Test x Operators
Named Unary list Operators
Input Output Operators
Math Operators
Regular Expressions
Using Regular Expresions
Regular Expressions References
Perl Pattern Matching
Pattern Matching Modifiers
Perl Substitution Operator
Perl Substitution Modifier
Perl e Modifier
e Substitution Modifier
Perl Selective Replacement
Perl Subexpressions Selective Replacement
Perl split Function
Extended Regular Expressions
Regular Expressions Conclusion
Regular Expression - Quiz
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.