|P is for Practical|
Re^2: sorting the column of array elementby sauoq (Abbot)
|on May 24, 2012 at 11:45 UTC||Need Help??|
Assuming, like you said, an array of arrayrefs—which is a good assumption, I think—this code would try to order the array refs in @array by the first elements contained in the arrays they reference.
That seems very unlikely to be what he wants.
If he wants to sort the array referenced by $array, the code I gave will work. If he wants to sort all of his "columns," he should sort the indexes based on his sorting column using something like:
And then use the array of sorted indexes to map the sorted order onto the actual columns with something like this:
It's up to him to be sure the "columns" are the same length, of course.
"My two cents aren't worth a dime.";