Module to store a hash as a simple indexed file?

T

timnels

I have the need to store a hash (actually multiple hashes) that have
thousands of records in a "keyed" file. The goal is to simply slurp up
a huge text file and create a keyed hash from a field in each line in
the file. Later on the application needs to fetch a _record_
(hopefully fast) from the hash using a key (without loading the whole
hash into memory). I've looked at some of the modules and they don't
seem to fit quite right. I'd rather not use DBM or a database to store
the data since the it's just a simple hash. Any ideas? Thanks.
 
G

Gunnar Hjalmarsson

I have the need to store a hash (actually multiple hashes) that have
thousands of records in a "keyed" file.

I'd rather not use DBM ... to store
the data since the it's just a simple hash.

Isn't that just what DBMs are for?
 
X

xhoster

I have the need to store a hash (actually multiple hashes) that have
thousands of records in a "keyed" file. The goal is to simply slurp up
a huge text file and create a keyed hash from a field in each line in
the file. Later on the application needs to fetch a _record_
(hopefully fast) from the hash using a key (without loading the whole
hash into memory). I've looked at some of the modules and they don't
seem to fit quite right.

What about them doesn't seem to fit quite right?
I'd rather not use DBM or a database to store
the data since the it's just a simple hash.

Obviously it is not just a simple hash, or else you would just be using
a simple hash table and your problem would be solved and you wouldn't be
posting here.
Any ideas? Thanks.

How about Storable? It won't be as fast as using the right tool, but it
might be good enough and it seems like you don't want to use the right
tool.

Xho
 
T

timnels

True. But I've got some older Unixes I am working with and building
modules like DBM and others are hit or miss. I'd like to use as much
stock Perl as I can.
 
A

A. Sinan Unur

(e-mail address removed) wrote in @g14g2000cwa.googlegroups.com:

What is true?

Please quote an appropriate amount of context when replying.

Sinan
 
G

Gunnar Hjalmarsson

True. But I've got some older Unixes I am working with and building
modules like DBM and others are hit or miss. I'd like to use as much
stock Perl as I can.

SDBM is shipped with Perl. Maybe not the fastest of the DBM
alternatives, but may be a decent solution considering those restrictions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,173
Messages
2,570,938
Members
47,473
Latest member
pioneertraining

Latest Threads

Top