Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: "or die" versus "|| die"

by aditya.singh (Acolyte)
on Jun 27, 2005 at 09:20 UTC ( #470181=note: print w/ replies, xml ) Need Help??


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

Both '||' and 'or' are similar. These operators allow you to perform one of the two operations, starting with the first operation on the left-hand side. If that evaluates to false, only then will right side of (||, or) will be evaluated.

In this case, if your open() fails then the program will die.

The difference comes when you use them in expressions. They have different precedence and '||' is evaluated before the 'or'. You can check perldoc perlop.


Comment on Re: "or die" versus "|| die"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://470181]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (16)
As of 2015-07-01 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (12 votes), past polls