in reply to 'or' vs '', '&&' vs 'and'
When you spell out those kewords ("||" as "or", "&&" as "and"), you are using a keyword with a lower precedence, thus allowing you to skip parentheses:
open (THEFILE, ">$file") || die "Could not create $file - $!\n"; # versus: open THEFILE, ">$file" or die "Could not create $file - $!\n";
I like spelling them out as they make reading the expression more natural (because it's a word instead of a symbol) and they allow you to avoid a lot of excessive parentheses.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: (Ovid) Re: 'or' vs '', '&&' vs 'and'
by admiralh (Sexton) on Apr 01, 2002 at 20:03 UTC | |
by Juerd (Abbot) on Apr 01, 2002 at 20:46 UTC |