[plug] Perl Question: Searching an array

David Buddrige buddrige at wasp.net.au
Wed Feb 26 16:39:33 WST 2003


Hi all, 

I have a perl program that contains a very large array.  I want to search 
this array to determine if it contains a particular value.  Is there a 
faster way to search the array than this? 


$search_val = "text-to-look-for";
$found = "false";
foreach $line ( @myarray )
{
   if ( $search_val == $line )
   {
       $found = "true";
   }
} 

I've beeen reading through "Learning Perl" but can't find any answer on this 
one. 8-) 


thanks heaps guys 

David Buddrige



More information about the plug mailing list