|Just another Perl shrine|
Conditional Sortingby monkfan (Curate)
|on May 11, 2007 at 05:06 UTC||Need Help??|
monkfan has asked for the
wisdom of the Perl Monks concerning the following question:
Suppose I have the following array and hash:
Now the key and value of $hash represent the following:
Now my question is, how can we sort decendingly @arr_sorted, such that for every index 'z' in @arr, the VALUE of its (z,y) <= (z,y+1)?
Members of @arr_sorted is exactly the same as @arr, only sorted according to the condition above. And yes, every 'z' has its corresponding @arr_sorted.
I'm not sure how to proceed from here: