in reply to Re^4: How would I sort a two-dimensional array by multiple columns?
in thread How would I sort a two-dimensional array by multiple columns?

NetWallah, That went abit over my head. So how would your code look like?

I am not clear on how I would implement this to

input:

@toBeSorted, 0, 1, 3)

output:

@sorted

Can I see what you code would look like so that I can study the correct way?


After all this is over, all that will really have mattered is how we treated each other.
  • Comment on Re^5: How would I sort a two-dimensional array by multiple columns?

Replies are listed 'Best First'.
Re^6: How would I sort a two-dimensional array by multiple columns?
by NetWallah (Canon) on Mar 15, 2008 at 22:44 UTC
    The only relevant part of the code I posted is "sub NetWallahSort".

    Just copy that sub into your code, and use it like:

    my @sorted = sort NetWallahSort @$unsorted; # Or, simply "@unsorted", if @unsorted is an Array-of-Arrays, # rather than a reference.
    FYI - a 2-Dimensional array is technically an "Array of Array-references".

    FonkyMonk makes his declaration ($unsorted) a scalar, which is a "reference to an Array of Array-references", or "a reference to a 2-d Array". As Sienfeld would say - not that there is anything wrong with that!

         "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom