LittleJack has asked for the wisdom of the Perl Monks concerning the following question:
To quote:
Logical And
Binary "and" returns the logical conjunction of the two surrounding expressions. It's equivalent to && except for the very low precedence. This means that it short-circuits: the right expression is evaluated only if the left expression is true.
and then:
C-style Logical And
Binary "&&" performs a short-circuit logical AND operation. That is, if the left operand is false, the right operand is not even evaluated. Scalar or list context propagates down to the right operand if it is evaluated.
Maybe it's just me, but these things seem to be the same:
What am I missing?
Any real-life examples of how the two would behave differently gratefully received.
Update: Thanks everyone for your input, very helpful and I get it now.
Where do I put in a patch request for Perldoc to be improved though?
The sentence 'This means that it short-circuits: the right expression is evaluated only if the left expression is true.' appears to refer to the clause 'the very low precedence' in the previous sentence, i.e. 'Very low precedence means that the right expression is evaluated only if the left expression is true'.
|
|---|