One day a programmer heard that logic operators in Perl worked incorrectly and decided to see it for herself. She ran a one-liner:
Huh… True AND False equals True. How so?
It’s nice to program in plain English:
How about this?
Why have two duplicating operators:
In Perl operators
and have different precedence
and the one-liners above differ in the order of evalution.
The second one is similar to C:
But the first program actually means:
or have low precedence
and they are a bad fit for logical expressions.
They are perfect for idioms such as
@info = stat($file) or die;