evienne has asked for the wisdom of the Perl Monks concerning the following question:

(Following up on How do I sort a multidimensional arrays?)
If I sort by index 5, then by index 2, then by index 3 (three sortings done in sequence), will I necessarily get a the same result as asking a spreadsheet to sort by column D, then by C, then by F? Or is it best not to assume?
  • Comment on How do I sort a multidimensional arrays?

Replies are listed 'Best First'.
Re: Answer: How do I sort a multidimensional arrays?
by JavaFan (Canon) on Mar 02, 2012 at 12:38 UTC
    Do note that "sort by X", "sort by Y", then "sort by Z" only gives you deterministic results if all values are unique, or if you are using a stable sort. Since perl 5.6, the default sort in Perl is stable, but this may chance in the future.

    Sorting by column D, then by C, then by F seems to quite different to me than sorting by index 5, then by index 2, then by index 3 (opposite order). Even if you reverse the orders so they match, then it will still depend on the spreadsheet. While one spreadsheet may use a stable sort, another may not.

Re: Answer: How do I sort a multidimensional arrays?
by Anonymous Monk on Mar 02, 2012 at 14:55 UTC