Perl Programming/Keywords/or

Previous: open Keywords Next: ord

The or keywordEdit

or is a logical short-circuit OR operator that has a very low precedence, but is otherwise equivalent to ||.

SyntaxEdit

  VALUE or VALUE

ExamplesEdit

  The code
$a = 5; # 0101
$b = 8; # 1000

print $a or $b . ", " . $a || $b . "\n";
prints only the first variable, as it is not false:
5


Previous: open Keywords Next: ord