Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Perl ternary operator style

by JavaFan (Canon)
on May 29, 2011 at 17:12 UTC ( [id://907231]=note: print w/replies, xml ) Need Help??


in reply to Perl ternary operator style

If you want X if X is true, otherwise Y, that operator is usually written ||. The only reason to use X ? X : Y instead is when you want to evaluate X twice. But that's not what you want according to your description. So:
$Target = Function($params) || $DefaultValue;

Log In?
Username:
Password:

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

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

    No recent polls found