This is a problem that is screaming to be solved by a simple search engine. Check out Plucene and Plucene::Simple. There is also a nice tutorial on it at Perl.com. Yes, the article talks about a web-based search engine, but putting it into a script should be just as easy.
In your situation, you'll need an initial parse on the file to create the indexes, but after that the lookups should be quick. It will also return the full record or records related to your search.
In reply to Re: Scanning a text file
by Steve_p
in thread Scanning a text file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |