in reply to use of pipes and 'or'
I was told that || was old and no longer acceptable
No longer acceptable for what?
or and || are not equivalent. They have different precedence.
There are situations where || lends itself better:
$x = $y || $z; # ok $x = ( $y || $z ); # ok (unrequired parens) $x = $y or $z; # XXX $x = ( $y or $z ); # ok
And there are situations where or lends itself better:$x = $y or $z; means ( $x = $y ) or $z;
open my $fh, '<', $qfn or die; # ok open(my $fh, '<', $qfn) or die; # ok (unrequired parens) open my $fh, '<', $qfn || die; # XXX open(my $fh, '<', $qfn) || die; # ok
open my $fh, '<', $qfn || die; means open my $fh, '<', ( $qfn || die );
|
|---|