http://www.perlmonks.org?node_id=469727


in reply to "or die" versus "|| die"

In your example it doesn't matter. One binds more tightly than the other, is the only real difference -- well, that and readablilty. || binds tighter. So, if you want to die after an assignment use or:

my $foo = $bar->fetch('baz') or die "something went wrong\n";
And if you want a default value, use ||
my $foo = $bar->fetch('baz') || 'default';

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)