Do you understand Perl's logical ||? The key point in the context you are having trouble understanding is that the tested value is returned. Other languages with a logical or return a boolean value. Perl returns the actual value. So:
0 || 'wibble'
returns the string wibble, not 1, -1 or true as you might get in other languages. That makes logical or very useful for providing default values.
In reply to Re: shift and logical or
by GrandFather
in thread shift and logical or
by jonagondos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |