As you can see, this example is very similar to the normal use of
DB_File; we just use MLDBM
instead, and tell it to use DB_File as an
underlying DBM implementation. You can choose any other available
implementation instead. If you don't specify one,
SDBM_File is used.

The script creates a complicated nested data structure and stores it
in the $rhscalar. Then we open the database and
store this value as usual.

When we want to retrieve the stored value, we do pretty much the same
thing as before. The script uses the
Data::Dumper::Dumper method to
print
out the nested data structure. Here is what it prints:

This limitation exists because the perl TIEHASH
interface currently has no support for multidimensional ties.

By default, MLDBM uses
Data::Dumper to serialize the nested data
structures. You may want to use the FreezeThaw or
Storableserializer instead. In fact,
Storable is the preferred one. To use
Storable in our example, you should do: