T
Tommo
Hello All,
whilst I know how to sort an array I am having problems with
my situation, what I would ideally like is something like a 'sort
keys' action with Perl hashes.
I am reading in data and building an array entry that will
be of the form:-
array[0] - horse1,2,4,6,1,3,6 = 22
...
array[6] - horse6,2,3,6,1,9,8 = 29
etc etc.
I know want to sort these array entries based on the totals (i.e 22,
29 etc), I figured you cannot do this in one array so maybe 2 arrays,
one array would be as follows:-
array1[0] - horse1,2,4,6,1,3,6 =
...
array1[6] - horse6,2,3,6,1,9,8 =
and the second array:-
array2[0] - 22
...
array2[6] - 29
I could then sort on the 2nd array, the trouble is that I loose the
relationship between the 2 arrays.
I thought about creating an object array to sort upon but am unsure if
this would work. Has anyone a solution to this and if so some example
code to help me along.
thanx, Mark ....
whilst I know how to sort an array I am having problems with
my situation, what I would ideally like is something like a 'sort
keys' action with Perl hashes.
I am reading in data and building an array entry that will
be of the form:-
array[0] - horse1,2,4,6,1,3,6 = 22
...
array[6] - horse6,2,3,6,1,9,8 = 29
etc etc.
I know want to sort these array entries based on the totals (i.e 22,
29 etc), I figured you cannot do this in one array so maybe 2 arrays,
one array would be as follows:-
array1[0] - horse1,2,4,6,1,3,6 =
...
array1[6] - horse6,2,3,6,1,9,8 =
and the second array:-
array2[0] - 22
...
array2[6] - 29
I could then sort on the 2nd array, the trouble is that I loose the
relationship between the 2 arrays.
I thought about creating an object array to sort upon but am unsure if
this would work. Has anyone a solution to this and if so some example
code to help me along.
thanx, Mark ....