[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Saving a hash to disk



>Is there an easy method of saving a Perl hash to disk? I'm sure there is
>something idiot-simple, but I've not been able to find it.

Have you thought of using the Perl DB_File module? A friend of mine
described it to me in a letter:

One interesting programming note was that I used the Perl DB_File module.
Have you ever used it?  One nice thing is that it automatically gives you
an on-disk hash table or b-tree.  Say you have a assoc-array %nodes, which
is tied to the Berkeley DB file stored on disk.  Simply saying print
$nodes{Chris} will retrieve it's value from disk.  If I'm playing the
game, I don't want to load the entire database into disk- too slow and too
much RAM- especially if multiple people keep reloading the program in a
CGI session.  Now I can  retrieve $nodes{$fragment} from disk, almost
instantaneously, because it's a hash table.  And logically, I write the
code as if it were in RAM (no change in syntax to access the data
structure).  I really like this module.

Dept of Molecular and Cell Biology      "Information wants to be free."
UC Berkeley  * Kane Lab 614 Barker Hall



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch