in reply to Thoughts on using and, or, and not over && || !?
For flow of control, prefer the low precedence and and or operators. A common example of preferring or to || is:
That is probably the principal use case as to why the low precedence operators were added to the language in the first place.open(my $fh, '<', $file) or die "error opening '$file': $!";
Reserve && and || for logical expressions, not flow of control, for example:
if ($x > 5 && $y < 10) ...
This is discussed in detail in Perl Best Practices, Chapter 4, "Values and Expressions" in the "Don't mix high- and low-precedence booleans" item.
|
|---|