Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by davido (Archbishop)
on Oct 24, 2003 at 18:15 UTC ( #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
Node Status?
node history
Node Type: note [id://301915]
help
Chatterbox?
[Tux]: you left the space in
[Tux]: and that \K is not required
[Tanktalus]: 11.31 is already 10 years old... you still need to support versions older than that? My condolences :)
[Eily]: meh, got confused. s/(?=\bis\b)/h/ will work better :)
[Eily]: \K keeps the thing on the left, not the right (IE, it's like look behind, not look ahead)
[Tux]: and 11.31 is still the last stable. We're moving all our customers to Linux (openSUSE and CentOS), but that takes a loooooooooooooooon g time
[LanX]: ehm ... I woke up my *boobs* ?
LanX where is the camera?
Tux => $HOME
[Eily]: you wrote boos instead of boss, and jedikaiti read that as boobs :)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2017-09-20 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (237 votes). Check out past polls.

    Notices?