Perl Programming/Keywords/or
< Perl Programming | Keywords
The or keyword
[edit | edit source]or is a logical short-circuit OR operator that has a very low precedence, but is otherwise equivalent to ||.
Syntax
[edit | edit source] VALUE or VALUE
Examples
[edit | edit source]![](http://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Crystal_Clear_action_apply.png/20px-Crystal_Clear_action_apply.png)
$a = 5; # 0101
$b = 8; # 1000
print $a or $b . ", " . $a || $b . "\n";
prints only the first variable, as it is not false:
5