in reply to Re: Re: Sorting with perl
in thread Sorting with perl

The example given suggests he wanted a stable sorting, hence my "use sort 'stable'". Your code only gives a stable sorting because that happens to be the default on 5.8.0, but that may change in a future version of perl (and if a sort happens to be stable in pre-5.8.0, it's just a coincidence).

Abigail

Replies are listed 'Best First'.
Re: Re: Sorting with perl
by fruiture (Curate) on Aug 12, 2002 at 14:35 UTC

    In fact, I didn't even think of the stability of the sort, assuming all keys would be mentioned in the guide-file anyway.

    --
    http://fruiture.de
      But even in the one example given it's shown that keys can appear multiple times. You don't have to assume that, it's given. And as you notice, where duplicate keys appear in the input, they appear in the same order in the output. Hence the stability.

      Abigail