in reply to Re: Basic Database?
in thread Basic Database?

Yes, the MLDBM does use Data::Dumper to store complex multi-level data structures. This module is also covered (briefly) in the O'Reilly Programming the Perl DBI Book - It is from this, that the following little example for illustration is drawn.
 
#!/usr/bin/perl -w # # ch02/mldbmtest: Demonstrates storaging complex data structures in a +DBM # file using MLDBM module. use MLDBM qw ( DB_File Data::Dumper ); use Fcntl; ### Remove the test file in case it exists already ... unlink 'mldbmtest.dat'; tie my %database1, 'MLDBM', 'mldbmtest.dat', O_CREAT | O_RDWR, 0666 or + die "Can't initialise MLDBM file: $!\n"; ### Create some megalith records in the database %database1 = ( 'Avebury' => { name => 'Avebury', mapref => 'SU 103 700', location => 'Wiltshire' }, 'Ring of Brodgar' => { name => 'Ring of Brodgar', mapref => 'HY 294 133', location => 'Orkney' } ); ### Untie and retie to show data is stored in the file untie %database1; tie my %database2, 'MLDBM', 'mldbmtest.dat', O_RDWR, 0666 or die "Can' +t initialise MLDBM file: $!\n"; ### Dump out via Data::Dumper what's been stored ... print Data::Dumper->Dump( [ \%database2 ] ); untie %database2; exit;

 
Another way which I have stored complex data structures before has been through the Storable module - This wonderful module even allowed me to store user preference hashes for a web site in a cookie!
 
Ooohhh, Rob no beer function well without!