Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 exploiting the Monastery: (8)
As of 2014-08-29 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (277 votes), past polls