Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: How to find out if X is an element in an array?

by guha (Priest)
on Nov 25, 2010 at 17:18 UTC ( #873689=note: print w/replies, xml ) Need Help??


in reply to How to find out if X is an element in an array?

#!perl use strict; use warnings; use List::MoreUtils qw{ any }; my @array = qw{ A B C D E X }; if (any { $_ eq 'X'} @array) { print 'YES'; } else { print 'NO'; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2023-03-27 00:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (63 votes). Check out past polls.

    Notices?