in reply to Hash Search Ranking

On a completely unrelated note, in Perl your for loop is better written:

for my $i (0 .. $#lines)

or if you don't need the index:

for my $line (@lines)
Premature optimization is the root of all job security