in reply to Sorting an array II

Um, an array does not have any labels. A hash has keys, which is what you're using in your examples. If you want to sort a hash by the keys, use your first example (if the keys are numerical). If you want to sort the values, alphanumerically, use straight sort (which uses the cmp operator, which sorts strings in ascending ASCII order (thus roughly alphabetic) ):
my @sorted_values=sort values %hash;

CU
Robartes-

Replies are listed 'Best First'.
Re: Re: Sorting an array II
by zakb (Pilgrim) on Mar 03, 2003 at 11:10 UTC

    And of course, if using the first example, substituting keys instead of labels in the -value line should stop the error.

      Stops the error but doesn't solve the problem.

      You may note that the first code snippet uses keys, which isn't what the OP wants...