import-bot (20211) [Avatar] Offline
#1
[Originally posted by bobx]

Is there a "hard and fast" rule to go by when using "||" or "or"?
import-bot (20211) [Avatar] Offline
#2
Re: || or OR
[Originally posted by jandrew]


> Is there a "hard and fast" rule to go by when using "||" or "or"?

Not really --- though some find "or" better for 'flow of control'
types of things in the vein of: do this "or" do that

open FILE, $file or die "Can't open $file: $!";

and prefer "||" for conditional expressions and defaults:

$file = $ARGV[0] || 'default';

if ($something || $otherthing) {}

My own tendency is to preferentially use "||" (and "&&") --- no doubt
influenced from C --- and parenthesize when necessary.

Not sure if that helps you or not smilie

regards,
andrew