This works fine and I've verified I have all of my data read in correctly. Now to sort. This will correctly sort by region:while (<>) { ... @fields = split ; #field[0] is the module. $entries{$region}{$fields[0]}{entry} = $fields[0] ; $entries{$region}{$fields[0]}{addr} = $fields[1] ; $entries{$region}{$fields[0]}{size} = $fields[2] ; $entries{$region}{$fields[0]}{type} = $fields[3] ; $entries{$region}{$fields[0]}{object} = $fields[5] ; ... }
This will then correctly sort by module:for my $region (keys %entries) { ... }
But then I can't sort by size. I've tried the following:for my $region (keys %entries) { for my $module (keys %{$entries{$region}}) { ... } }
I've tried a bunch of other syntaxes as well. And I always get "Can't use string ("0x...") as a HASH ref while "strict refs" in use at line ... (the last 'for' line). Any ideas what I'm doing wrong? Thanks in advance. Danfor my $size (sort {%{$entries{$region}{$a}{size}} <=> %{$entries{$reg +ion}{$b}{size}}} keys %{$entries{$region}}) { ... }
In reply to How do I sort hash of hashes of hashes by DanEichenwald
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |