Ineffectual has asked for the wisdom of the Perl Monks concerning the following question:
I have ~3k of $name, and around 5 of measurement for each $name and there are 10 qualities such as size. In order to select the "best" one of these measurements for each name, I need to do some sort of selection on several of the different qualities. Thus, it seems I need to sort the inner hash. However, I'm not sure how to sort the qualities into descending order and keep the mapping of which measurement the quality applies to. For example: Name 1 has 5 measurements. The 5 measurements have SIZEs of 100, 200, 300, 400, and 500. If I want to order on the SIZE quality, how do I do this? It'd be great if this would work on qualities that are numbers and letters. Esentially I need to order the 10 different qualities in a variety of ways to find the "best" representation by those qualities. I'm more than happy to change the data structure if someone can recommend something better (I heard mention of AoA in the chatbox, but I'm not sure how to keep the measurement qualities separate in an AoA).$data{$name}{$measurement}{'SIZE'} = $size
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Choosing "best" - sorting hashes issue
by dragonchild (Archbishop) on Jan 14, 2005 at 19:35 UTC | |
|
Re: Choosing "best" - sorting hashes issue
by samizdat (Vicar) on Jan 14, 2005 at 20:03 UTC | |
by dave_the_m (Monsignor) on Jan 14, 2005 at 22:18 UTC | |
by samizdat (Vicar) on Jan 17, 2005 at 14:57 UTC | |
by samizdat (Vicar) on Jan 17, 2005 at 14:35 UTC | |
|
Re: Choosing "best" - sorting hashes issue
by BrowserUk (Patriarch) on Jan 14, 2005 at 20:41 UTC |