use strict;
use warnings;
use Storable;
my %hash;
$hash{"Janet Jones"} = {
"spouse" => "Bob Jones",
"son 1" => "Tom Jones",
"son 2" => "Pete Jones",
"pet 1" => "Boyle",
"father" => "Richard Smith",
"mother" => "Fran Smith",
"sister 1" => "Louise Williams",
"address" => "1 Main St, Littleton, PA, 55555",
};
$hash{"Bob Jones"} = {
"spouse" => "Janet Jones",
"son 1" => "Tom Jones",
"son 2" => "Pete Jones",
"pet 1" => "Boyle",
"father" => "Paul Jones",
"mother" => "Stella Jones",
"brother 1" => "Paul Jones, Jr",
"brother 2" => "Vince Jones",
"brother 3" => "Dan Jones",
"sister 1" => "Andrea Limux",
"address" => "1 Main St, Littleton, PA, 55555",
};
store(\%hash, "HashOfHashesFile.txt");
my %friends = %{retrieve("HashOfHashesFile.txt") };
for my $name (keys %friends){
print "$name->\n";
for my $info(keys %{$friends{$name}}){
print " " x length("$name");
print "$info-> $friends{$name}{$info}\n";
}
}
####
Janet Jones->
spouse-> Bob Jones
son 1-> Tom Jones
pet 1-> Boyle
mother-> Fran Smith
father-> Richard Smith
address-> 1 Main St, Littleton, PA, 55555
son 2-> Pete Jones
sister 1-> Louise Williams
Bob Jones->
spouse-> Janet Jones
son 1-> Tom Jones
brother 3-> Dan Jones
pet 1-> Boyle
mother-> Stella Jones
brother 2-> Vince Jones
father-> Paul Jones
brother 1-> Paul Jones, Jr
address-> 1 Main St, Littleton, PA, 55555
sister 1-> Andrea Limux
son 2-> Pete Jones
####