"That means that if evaluates to the same thing as its condition if the condition evaluates to something false, and if evaluates to the same thing as its body otherwise."
For what it's worth, B::Deparse has this to say about it:
perl -MO=Deparse,-x9 -e 'if($a<$b){$a;}' $a < $b and do { $a };
Looking at that makes a lot of sense: and being a logical short circuit means that if $a < $b evaluates to false, the right hand side is never evaluated. Consequently, the return value has to be the value of the relational expression.
On the other hand, if $a is less than $b, the conditional is true, and the logical and allows the right hand side to be evaluated.
if( $a < $b ) { $a } $a < $b and do { $a };
Two ways of looking at it. The latter seems to me to make a lot of sense.
Dave
In reply to Re^2: Map Function Weirdness
by davido
in thread Map Function Weirdness
by rthawkcom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |