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

Well, if you think the same, i can't be too wrong ;)

--
http://fruiture.de

Replies are listed 'Best First'.
Re: Sorting with perl
by Abigail-II (Bishop) on Aug 12, 2002 at 13:56 UTC
    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

      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