in reply to sorting an array of hashes by the value of the keys
Here's what I would do.
First, get a list of all of the hash keys you want to sort. Since the hash is so deeply nested, it may be easiest to store the results in an array ref:
Now that you have the keys in an array, you can sort them:foreach my $k1 (keys %bighash) { foreach my $k2 (keys %{$bighash{$k1}}) { ... push(@keys,[$k1, $k2, ...]);
@keys = sort by_key_total @keys; sub by_key_total { $bighash{$a->[1]}{$a->[2]}{$a->[3]}{$a->[4]}[$a->[5]][$a->[6]] <=> $bighash{$b->[1]}{$b->[2]}{$b->[3]}{$b->[4]}[$b->[5]][$b->[6]] }
|
|---|