Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: how to quickly tell if number is in an arrayby Rajeshk (Scribe) |
on Oct 12, 2005 at 10:31 UTC ( [id://499445]=note: print w/replies, xml ) | Need Help?? |
Hi, Try this code.. @a = (1,3,5); $number = 3; if((grep /$number/, @array)){ print "Found"; }else{ print "Not Found"; } Thanks Rajesh.K
In Section
Seekers of Perl Wisdom
|
|