in reply to storing a huge text file into a hash

Another clever-trick is a tied hash.   This looks like a hash but it is backed by some other storage mechanism, such as Berkeley-DB.

But, lately, I think that this has paled in favor of SQLite (http://www.sqlite.org) ... a public domain(!) flat-file database that works extremely well.   You could prepare an SQL query ahead of time, then execute it repeatedly to retrieve “the ’droid you’re looking for.”   It is blazingly fast.