I think what may help is MLDBM. From the README:
This is the README file for MLDBM, the Perl module that can
be used to store multidimensional hash structures in tied hashes
(including DBM files).
I can't actually check the documentation because <whine> CPAN is down </whine>, but I believe it uses Data::Dumper to store Perl data types in the DB. Good luck!
-Eric