#%hash has been filled with some meta data in an array read in #from the smaller flat file #The first element is the name we are searching for. #the rest are irrelevant to this loop # #fh_log is a file handle to the large 300mb+ flat file #each line may contain references to 1 or more table names, and #I need to capture all of them. while($cur_line=) { foreach $key (keys %hash) { $table = $hash{$key}[0]; #If this query contains reference to this table if($cur_line=~ m/$table/i) { #count up how many times this table is referenced. $table_stats{$table}++; $table_refs++; #total table references (for % calc) } } }