[prev] [index] [next]

Logical Operators

Perl has two sets of logical operators, one like C, the other like "English".

The second set has very low precedence, so can be used between statements.

Operation   Example   Meaning
And   x && y   false if x is false, otherwise y
Or   x || y   true if x is true, otherwise y
Not   ! x   true if x is not true, false otherwise
And   x and y   false if x is false, otherwise y
Or   x or y   true if x is true, otherwise y
Not   not x   true if x is not true, false otherwise