Yes!
|| returns the value that dictated the outcome of the operation - either the left hand value if it was true, or the right hand value if the left is false. See perlop and keep in mind that Perl has useful ideas about what constitutes true and false. undef, '', '0' and 0 are all false. Consider:
print undef || "undef is false", "\n";
print 0 || "0 is false", "\n";
print '' || "'' is false", "\n";
print '0' || "'0' is false", "\n";
print '0xxx' || "'0xxx' is false", "\n";
print 'false' || "'0xxx' is false", "\n";
print '1' || "'0xxx' is false", "\n";
Prints:
undef is false
0 is false
'' is false
'0' is false
0xxx
false
1
Perl is environmentally friendly - it saves trees
|