In controlling the logic of a conditional expression logical operators are frequently required.
In Perl, The logical AND operator is &&
and logical OR is
||
.
For example to check if a valid number exist in a variable
$var
you could do:
if ( ($var ne "0") && ($var == 0)) { # $var is a number }
Since Perl evaluates any string to 0 if is not a number.