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

Re^2: Perl Idioms Explained - !!expr

by davidrw (Prior)
on Nov 05, 2005 at 02:55 UTC ( #505935=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl Idioms Explained - !!expr
in thread Perl Idioms Explained - !!expr

I would also mention just a simple ternary operator as an alternative:

return grep($_ eq $_[0], @_[ 1 .. $#_ ]) ? 1 : '';
or, more generally the equivalent to !!$expr is (some of the parens are optional depending on context):
(($expr)?1:'')


Comment on Re^2: Perl Idioms Explained - !!expr
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2014-10-31 12:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (217 votes), past polls