Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Perl Idioms Explained - !!expr

by davidrw (Prior)
on Nov 05, 2005 at 02:55 UTC ( [id://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:'')

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-24 14:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found