Selecting Between Two Aggregates
Perlでの||演算子とor演算子の違いについて、podに良例が記載されているのを見つけました。
In particular, this means that you shouldn't use this for selecting between two aggregates for assignment: @a = @b || @c; # this is wrong @a = scalar(@b) || @c; # really meant this @a = @b ? @b : @c; # this works fine, though
perlopのC-Style Logical Or節です。また、同じくperlopのLogical or and Exclusive Or節にも興味深い記述があります。
Binary "or" returns the logical disjunction of the two surrounding expressions. It's equivalent to || except for the very low precedence.
$a = $b or $c; # bug: this is wrong ($a = $b) or $c; # really means this $a = $b || $c; # better written this way