Same as it works for anything else. perlop probably describes this well. "||" and "or" both evalute to the left-hand-side (LHS) if it is true, otherwise it evaluates to the right-hand-side (RHS).
Since an empty array is considered "false", the or operator evaluates the RHS and returns its value.
In reply to Re: Using || operator with arrays
by Tanktalus
in thread Using || operator with arrays
by perl_lover
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |