Chapter 7. BUILDING AN INTERACTIVE PERL SCRIPT
Introducing Perl Conditions
You use Perl conditions as tests to validate data as it progresses through your Perl script. You will most often find Perl conditions within parenthesis immediately following statement modifiers: statements that begin with commands like if, elsif
, and unless
which introduce a sub-block of code to be executed only if the condition is true.
Conditions are often split into three parts: a value, an operator — a simple command that mathematically or logically compares the two values — and another value. A value may be a variable, a function, a subroutine, or a hard-coded integer or string. For example, the conditional test, if ( $x > 5 )
is true if $x
's value is greater than five. ...
Get Perl and Apache: Your visual blueprint for developing dynamic Web content now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.