in reply to Re: I need to sort a 2D list.
in thread I need to sort a 2D list.

Thank you for the information. It will work well. However, I forgot to mention that if two value are equal, they take the next two ranks and divide by two. For example:
$total[1][1] = 123; $total[2][1] = 345; $total[3][1] = 222; $total[4][1] = 222; rank[1][1] should be 1 rank[2][1] should be 4 rank[3][1] should be 2.5 #(3+2)/2 rank[4][1] should be 2.5 #(3+2)/2
How can I do this?

Replies are listed 'Best First'.
Re: Re: Re: I need to sort a 2D list.
by iakobski (Pilgrim) on May 08, 2001 at 17:44 UTC
    Well that should be easy - instead of incrementing by one each time through the loop, you need to count the number of values at that rank. Then do a separate increment before and after using the rank.

    I reckon for num values at the given rank you would need (num - 1)/2 as the post-increment and (num - postincrement) as the pre-increment, but you know what you are trying to achieve.

    -- iakobski