Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to store a nested hash
using MLDBM and the serializer as Storable.
I am not getting the right output as expected
and i am not sure if i have used both correctly
I would like to know how to store the hash and then retrieve
any help would be appreciated.
thanx

Replies are listed 'Best First'.
Re: MLDBM and Storable
by mce (Curate) on Dec 24, 2002 at 08:27 UTC
    Hi,

    What do you mean: .. have used both correctly...

    Plain MLDBM and Storable are complementary. You can use both to store a multilevel hash to disk. In fact MLDBM can use Storable as serialiser. So you don't need to use both.

    You need to use

    use MLDBM qw(DB_File Storable);

    Once you tie-ed the hash, the rest is just transparent. Just fetching the value, setting is or destroying it will change the values on the disk.

    I hope this helps. If not, please post some code.
    ---------------------------
    Dr. Mark Ceulemans
    Senior Consultant
    IT Masters, Belgium

Re: MLDBM and Storable
by FamousLongAgo (Friar) on Dec 24, 2002 at 04:48 UTC
    Could you post the hash you are trying to store, and the unexpected results ( along with what you expected them to be )? That will help us help you.
      The hash is of the type
      hash{name}{cookie}->[0]
      I am using the Data::Dumper module
      which is being very slow.
      I want to store this hash in MLDBM
      and then retrieve it at a later time for using it again.
      Thanx