Generation of A HASH OF HASHES: # Reading From File
Generation of A HASH OF HASHES: # Reading From File
Generation of A HASH OF HASHES: # Reading From File
while ( <> ) {
$who = $1;
$HoH{$who}{$key} = $value;
while ( <> ) {
$who = $1;
$rec = {};
$HoH{$who} = $rec;
$rec->{$key} = $value;
}
$HoH{$group} = { get_family($group) };
%members = get_family($group);
$HoH{$group} = { %members };
%new_folks = (
);
$HoH{flintstones}{$what} = $new_folks{$what};
}
# one element
$HoH{flintstones}{wife} = "wilma";
# another element
$HoH{simpsons}{lead} =~ s/(\w)/\u$1/;
print "}\n";
print "}\n";
print "}\n";
$i = 0;
keys $HoH{$family}->%* )
print "}\n";
$rec = {
};
print $rec->{TEXT};
print $rec->{SEQUENCE}[0];
print $rec->{LOOKUP}{"key"};
$answer = $rec->{THATCODE}->($arg);
use FileHandle;
$rec->{HANDLE}->autoflush(1);
$rec->{HANDLE}->print(" a string\n");
%TV = (
flintstones => {
members => [
],
},
jetsons => {
members => [
],
},
simpsons => {
members => [
},
);
$rec = {};
$rec->{series} = "flintstones";
$rec->{nights} = [ find_days() ];
@members = ();
while (<>) {
$rec->{members} = [ @members ];
# now remember the whole thing
###########################################################
###########################################################
@kids = ();
if ($person->{role} =~ /kid|son|daughter/) {
$rec->{kids} = [ @kids ];
}
# you copied the array, but the array itself contains pointers
# older via
$TV{simpsons}{kids}[0]{age}++;
print $TV{simpsons}{members}[2]{age};
}
print "it turns out that $TV{$family}{lead} has ";
print "\n";
Database Ties
You cannot easily tie a multilevel data structure (such as a hash of hashes) to a dbm file.
The first problem is that all but GDBM and Berkeley DB have size limitations, but beyond
that, you also have problems with how references are to be represented on disk. One
experimental module that does partially attempt to address this need is the MLDBM
module. Check your nearest CPAN site as described in perlmodlib for source code to
MLDBM.