Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Possible precedence issue with control flow operator

by Eily (Monsignor)
on Jan 13, 2020 at 11:23 UTC ( [id://11111356]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl -MO=Deparse -e "sub test { return int(rand(2)) or print 'Nope' }"
    sub test {
        print 'Nope' unless return int rand 2;
    }
    -e syntax OK
    
  2. or download this
    my $result;
    $result = something() or croak "Something went wrong";
    return $result;
    
  3. or download this
    sub mySub
    {
      ...
      something() or croak "Times are a'croaking";
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found