Still learning the ins/outs of hashes...this code seems to work, but not when reading from the db (uncommenting db lines). I understand the database stores data as a hash so perhaps I am missing something?
Code:
#!/usr/bin/perl -w
#dbmopen(%events,"events",0666)||die;
%events = (
q123 => {
husband => "fred",
wife => "wilma",
},
q456 => {
husband => "george",
wife => "jane",
},
q789 => {
husband => "homer",
wife => "marge",
},
);
for $family ( sort keys %events ) {
print "$family: ";
for $role ( keys %{ $events{$family} } ) {
if($role =~ /husband/){ print "$role=$events{$family}{$role} ";}
}}
#dbmclose(%events);
exit;