If the file is sorted you might want to checkout the Search::Dict module.
I found it to be amazing fast.
I used it in my search engine 192283
Basically it works like
my $newpos=look *FILE, $string, 0, 0;
Q: Why did the Perlmonk cross the road?
A: He wanted to escape the match.