in reply to Checking a string's presence within an array.
How about grep. A hash is probably best, but if you are stuck with an array, grep is the simplest way to check.
$x=grep /^c$/,@array_I_just_created_here;
Assigning the results of grep in a scalar context returns number of matches. $x == 0 means it's not in the array.
HTH
|
|---|