in reply to search pattern and arrays
Load the list of phrases into my %Phrases;
Then, instead of doing
if ( $_ =~ /$search/ )
use
if ( defined $Phrases{$_} )
By the way, $. is the current input line-number; you don't have to keep track yourself.
Revised (for clarity): A variable prefaced with a percent sign is a hash, the equivalent of an array using a string (rather than a number) as an index. The defined function says "Is there an element of the hash having the specified index?".
| A reply falls below the community's threshold of quality. You may see it by logging in. |