in reply to Searching text files

I go with the db suggestion too.

Perhaps have a look at DBM::Deep? It's pure Perl, well suited to large lookup tables and, according to the docs, "pretty fast".

The docs also discuss speed/memory issues which you may find suit your requirements.