Just a general note here, but the primary goal of databases isn't always purely efficiency in dealing with data (particularly if you include speed in the definition of efficiency). Databases deal with a lot of overhead (security, integrity, data locking, etc.) that you may (or may not) need.
As far as hashes, I believe the docs indicate that they're limited only by PC memory, and that the structure of the hash will keep access time even in large hashes quick (I swear I recall the quote "a large hash is nothing to fear" from Learning Perl). I think your second option is probably going to be much quicker.