ChrisR has asked for the wisdom of the Perl Monks concerning the following question:
I would to end up with a new array that holds the indexes of the @a array sorted by the values for the hash key total. For example:$a[1]{total} = 10; $a[2]{total} = 50; $a[3]{total} = 40; $a[4]{total} = 30; $a[5]{total} = 20;
I just can't seem to get a grip on this one.$b[1] == 2; #$a[2]{total} = 50 $b[2] == 3; #$a[3]{total} = 40 $b[3] == 4; #$a[4]{total} = 30 $b[4] == 5; #$a[5]{total} = 20 $b[5] == 1; #$a[1]{total} = 10
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Indexing a data structure
by Roger (Parson) on Oct 16, 2003 at 03:12 UTC | |
|
Re: Indexing a data structure
by Fletch (Bishop) on Oct 16, 2003 at 02:13 UTC | |
by ChrisR (Hermit) on Oct 16, 2003 at 02:39 UTC | |
by graff (Chancellor) on Oct 16, 2003 at 03:11 UTC | |
by ChrisR (Hermit) on Oct 16, 2003 at 14:04 UTC | |
by Roger (Parson) on Oct 16, 2003 at 06:22 UTC | |
by Fletch (Bishop) on Oct 17, 2003 at 00:49 UTC | |
|
Re: Indexing a data structure
by princepawn (Parson) on Oct 16, 2003 at 02:34 UTC |