in reply to Problem: read a GDBM hash with 2 keys in perl

Does the GNU dbm library allow you to store complex structures? I would assume it only allows you to store plain strings, like most of the dbms except DBM::Deep do.

  • Comment on Re: Problem: read a GDBM hash with 2 keys in perl

Replies are listed 'Best First'.
Re^2: Problem: read a GDBM hash with 2 keys in perl
by cscat (Initiate) on Jun 29, 2010 at 17:30 UTC
    When I print the results in create.pl, it is ok and it seams GDBM allows multidimensional hashtables. But as I said, when opening the .db file, it messes up. What should I to sort this out? Thanks, Reza
      and it seams GDBM allows multidimensional hashtables

      GDBM_File does definitely not allow multidimensional structures (just checked the sources).  Unless you serialize them, that is. See Storable, for example.

        Thanks for your time. As I am new to Perl, what about assigning a list as the VALUE in the hash? is it possible or GDBM doesn't support it again?!
        key => value Iran => ((1,2),(3,1))
        The value was an array (1,2) and I pushed another array to it (3,1) and then store it as the value. This is not multidimensional, so there shouldn't be any issues, right? Cheers, Reza