#!/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;
In reply to Re: Re: Basic Database?
by rob_au
in thread Basic Database?
by tomazos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |