Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Do you know where your variables are?
 
PerlMonks  

Re: 'or' vs '', '&&' vs 'and'

by brianarn (Chaplain)
on Apr 01, 2002 at 14:21 UTC ( [id://155825]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to 'or' vs '', '&&' vs 'and'

The difference is the precedence, which can be handy not just for opening files. I still prefer to use parens when I open cause I like the look of it better, but then use an or as well.

You can also mix them to make some checks easier, seeing as || has a higher precedence than and, saving some parentheses.
if ($a || $b and $c) if (($a or $b) and $c) if(($a||$b)&&$c)
All of these lines are equal.
The parens add readability, but hey, maybe you like the visual of only one set of parens. :) TMTOWTDI

~Brian

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://155825]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.