Siblings, I've got a nasty feeling this is going to be one of those nodes that stands as a lasting monument to my inability to see what's in front of my nose. But. I've got a data structure that prints out like this from Data::Dumper (just to be sure it really is the structure I want):
$VAR1 = {
'1' => {
'1' => {
'EMail' => 'norbert@thnwb.com',
'Name' => 'Norbert Bodkin'
},
'5' => {
'EMail' => 'sue@thnwb.com',
'Name' => 'Sue Soup'
}
},
'2' => {
'3' => {
'EMail' => 'max@thnwb.com',
'Name' => 'Max Grappler'
}
}
};
Now, say I want to print out everyone's name, ordered first by the key of the "outer" hash and then by the next hash in (
i.e. in this case exactly the order you see them above) I tried to do:
106 my $status;
107 for $status (keys %Status) {
108 for (keys %{ $Status{$status} }) {
109 print $Status{$status}{$_}{'Name'}, br;
110 }
111 }
(line numbers added for clarity) BUT... I get
Can't use string ("1") as a HASH ref while "strict refs" in use at /home/htdocs/hosted/thinweb/lib/devbox.pm line 108.
I tried a few other lame ways to do it which I won't go into her, but when I RTFMed, I found that my first cut was pretty much the staff solution... as far as I could tell. I even got superstitious and tried
105 my $status;
106 my $id;
107 for $status (keys %Status) {
108 for $id (keys %{ $Status{$status} }) {
109 print $Status{$status}{$id}{'Name'}, br;
110 }
111 }
... nada.
I'm stumped... I crave enlightenment... no matter how humiliating.
§
George Sherston