in reply to Sorting Question

I don't see any sorting going on in this code. What exactly are you trying to sort? If you are trying to sort @list, try this:

@list = sort({$a cmp $b} @list);
May the Force be with you

Replies are listed 'Best First'.
Re^2: Sorting Question
by Roy Johnson (Monsignor) on Oct 04, 2004 at 18:49 UTC
    Which is just the same as @list = sort @list

    Caution: Contents may have been coded under pressure.
      although you may want to actually sort alphabetically (ie case-insensitive) instead of ASCIIbetically:
      @list = sort { lc $a cmp lc $b } @list;

        Which is why it's often a good idea to use locale when sorting. Then you don't have to contort yourself so much to get good sorting results.

        --
        Damon Allen Davison
        http://www.allolex.net