Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to check whether my array contains element x

by LanX (Canon)
on Jan 17, 2013 at 13:03 UTC ( #1013772=note: print w/ replies, xml ) Need Help??


in reply to How to check whether my array contains element x

Recent Perl versions have the smart-match-operator '~~'.

Try

$entityName ~~ @array_to_be_checked

Update
DB<104> @array= qw/http-listener-1 http-listener-2 http-listener-3 h +ttp-listener-4/ DB<106> 'http-listener-2' ~~ @array => 1 DB<108> 'nonsense' ~~ @array => ""

Cheers Rolf


Comment on Re: How to check whether my array contains element x
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2015-07-29 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls