I'm trying to sort the keys in a nested hash and it's not working right.
My data is sort of like this
I'm looping through each group and trying to sort the member numbers to display the status information in a report.
I originally had:
which got me the following as expected
So I checked some books and searched the web and came up with these:
These sort of worked most of the time, but I got patches like
Any help will be greatly appreciated.
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!
My data is sort of like this
Code:
%status_info -- group | member | snapshot | condition
AAA |
|- 1 |
|- 1 = Good
|- 2 = Good
|- 3 = Bad
|- 4 = Good
|- 2 |
|- 1 = Good
|- 2 = Ugly
|- 3 = Good
|- 4 = Good
|- 3 |
|- 1 = Good
|- 2 = Good
|- 3 = Good
|- 4 = Good
ABA .....
I'm looping through each group and trying to sort the member numbers to display the status information in a report.
I originally had:
Code:
foreach $this_mem (sort keys %{$status_info{$this_tg}}){
.... deleted stuff ....
}
which got me the following as expected
Code:
1
10
11
12
.....
So I checked some books and searched the web and came up with these:
Code:
foreach $this_mem (sort {$rpt_info{$this_tg}{$a} cmp $rpt_info{$this_tg}{$b}}
keys %{$rpt_info{$this_tg}}) {
and
foreach $this_mem (sort {$rpt_info{$this_tg}{$a} <=> $rpt_info{$this_tg}{$b}}
keys %{$rpt_info{$this_tg}}) {
These sort of worked most of the time, but I got patches like
Code:
70
71
132
133
134
74
75
and
130
131
262
263
264
265
266
267
268
135
136
Any help will be greatly appreciated.
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!