T
timnels
I am trying to use MLDBM to store a large number of hash entries for
which each hash entry is an hash of an array. It seems to me the MLDBM
can handle this structure, unless I try and modify a hash entry I have
added. It seems to be "insert only". If I am not missing something,
what are the alternatives?
The code (below) leaves off "item3" unless I don't use MLDBM. The
output:
$VAR1 = {
'hashkey' => {
'hash' => [
'item1',
'item2'
]
}
};
For:
use MLDBM;
use Data:umper;
use Fcntl;
use strict;
my %hash;
#
# Comment out this line and item3 is added.
#
tie(%hash, 'MLDBM', 'tmp', O_TRUNC|O_RDWR|O_CREAT, 0666);
$hash{hashkey} = { hash => [ "item1","item2" ] };
push @{$hash{hashkey}->{hash}}, "item3";
Data:umper->Indent(1);
print Dumper(\%hash);
which each hash entry is an hash of an array. It seems to me the MLDBM
can handle this structure, unless I try and modify a hash entry I have
added. It seems to be "insert only". If I am not missing something,
what are the alternatives?
The code (below) leaves off "item3" unless I don't use MLDBM. The
output:
$VAR1 = {
'hashkey' => {
'hash' => [
'item1',
'item2'
]
}
};
For:
use MLDBM;
use Data:umper;
use Fcntl;
use strict;
my %hash;
#
# Comment out this line and item3 is added.
#
tie(%hash, 'MLDBM', 'tmp', O_TRUNC|O_RDWR|O_CREAT, 0666);
$hash{hashkey} = { hash => [ "item1","item2" ] };
push @{$hash{hashkey}->{hash}}, "item3";
Data:umper->Indent(1);
print Dumper(\%hash);