The problem is that the underlying gdbm library stores mere strings as the value of an entry, not Perl data structures. And the Perl module GDBM_File (which is just a thin wrapper around the library) doesn't provide any automatic serialization/deserialization either.
In other words, you'd have to do that yourself (using Storable, Data::Dumper, whatever) if you want to stick with GDBM. I.e., convert the Perl data structure into a sequence of bytes (serialization) upon writing, which you'd then have to convert back into a Perl data structure (deserialization) after having read the string from the DB. Personally, I would rather use another module better suited for the task (like the already mentioned DBM::Deep).
In reply to Re^5: Problem: read a GDBM hash with 2 keys in perl
by almut
in thread Problem: read a GDBM hash with 2 keys in perl
by cscat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |