in reply to printing data structure
hash → key: given name, value: family
family → reference to array of given names
foreach my $surname (keys %data) { my $family = $data{$surname}; foreach my $given (@$family) { print("$given $surname\n"); } }
Giving meaningful names helps. Creating variables in order to use meaninful names helps. $key, $value and @tmp are bad names.
By the way, when using Dumper, it's best if you pass a scalar. print Dumper(\%data);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: printing data structure
by Anonymous Monk on Jan 08, 2007 at 19:54 UTC | |
by ikegami (Patriarch) on Jan 08, 2007 at 19:56 UTC | |
by Anonymous Monk on Jan 08, 2007 at 20:15 UTC | |
by ikegami (Patriarch) on Jan 08, 2007 at 20:19 UTC | |
by Anonymous Monk on Jan 08, 2007 at 20:03 UTC |