Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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:'')

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://505935]
help
Chatterbox?
[atcroft]: Sounds like it will make display modifications a little easier when you are done, at least.
[Lady_Aleena]: Well, some of the data returned is taylored for the printing of certain elements.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2017-05-29 02:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?