in reply to Scanning a text file

This just cries for MySQL's fulltext search, but I suppose you won't be allowed to do that.

How big is the file? If it's small enough (less than a megabyte, say), you could just slurp it in, make each whole record into a single array element, and simply search over them with

@hits=grep(/$term/,@directory);

And if it's more than a megabyte, do it with MySQL and just don't tell them :-)

Update:Aagh, what was I thinking - of course there is no need to slurp the whole file into memory - unless you wanted to make a search server :-)