Dear Monks,
I am working with hash of arrays that need to be sorted. I would like the order to be driven by the highest Score value per entry key and then sorted within each key based on Score. It would be easy if not for the Location arguments that I would like to mirror the Score sorting. Example;my %entry; push @{$entry{'BLA'}{Score}}, 5; push @{$entry{'BLA'}{Location}}, '1-10'; push @{$entry{'TRA'}{Score}}, 15; push @{$entry{'TRA'}{Location}}, '7-15'; push @{$entry{'TRA'}{Score}}, 23; push @{$entry{'TRA'}{Location}}, '4-19'; push @{$entry{'TRA'}{Score}}, 2; push @{$entry{'TRA'}{Location}}, '78-120'; push @{$entry{'BLA'}{Score}}, 10; push @{$entry{'BLA'}{Location}}, '2-10'; Output; TRA 23 4-19 TRA 15 7-15 TRA 2 78-120 BLA 10 2-10 BLA 5 1-10
Any ideas? Speed is a factor and for various reasons within the code I have to stick with this particular data structure. I presume once it's sorted and I don't add anything it will stay sorted? Thanks for help.
In reply to Advance Sorting by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |