Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Perl Idioms Explained - && and || "Short Circuit" operators

by davido (Cardinal)
on Oct 24, 2003 at 18:15 UTC ( [id://301915]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        $a = $b or $c;     # bug: this is wrong
        ($a = $b) or $c;   # really means this
        $a = $b || $c;     # better written this way
    
  2. or download this
        @info = stat($file) || die;    # oops, scalar sense of stat!
        @info = stat($file) or die;    # better, now @info gets its due
    
  3. or download this
        open INFO, "< datafile"  or die "can't open datafile: $!";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2024-04-23 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found