5.2. The "and" and "or" Operators
Perl supplies two operators and
and or
which are equivalent to &&
and ||
except that they have a very low precedence. (lower than any other operator in fact). There's also not
which is the ultra-low precedence equivalent of !
.
You can use them after a statement to write error handlers.
#!/usr/bin/env perl use strict; use warnings; # Terminate if we cannot open a file. open O, ">", "/hello.txt" or die "Cannot open file!"; print O "Hello World!\n"; close(O);