[EMAIL PROTECTED] (John W. Krahn) wrote in
news:[EMAIL PROTECTED]:
>
> If all the elements are unique then use a hash.
>
> if ( exists $hash{ 'my string' } ) {
> # do something
> }
>
>
> The most efficient way to determine if an element exists in an array
> is to use a for loop and
Hi,
Is there a better way to search all elements of an array for a string
(without using a loop to test individual elements) than:
$line = join(' ',@myarray);
if ($line =~ /my string/) {
some code
}
I've seen map and grep used by some but also critisized by some. I thought
there might