in reply to Sorting - lower to upper

Don't forget about the Schwartzian Transform:
my %hash = qw/John 1 Bob 1 xavier 1 alice 1/; my @keys = map { tr/a-zA-Z/A-Za-z/; $_ } sort map { tr/a-zA-Z/A-Za-z/; $_ } keys %hash; print "@keys\n";
Will give you
alice xavier Bob John

Replies are listed 'Best First'.
•Re^2: Sorting - lower to upper
by merlyn (Sage) on Jul 15, 2004 at 17:04 UTC
      Taking merlyn's advice into account, I'll change my answer;-)

      --from above--

      Don't forget about the Schwartzian Transform:
      my %hash = qw/John 1 Bob 1 xavier 1 alice 1/; my @keys = map { (my $x = $_) =~ tr/a-zA-Z/A-Za-z/; $x } sort map { (my $x = $_) =~ tr/a-zA-Z/A-Za-z/; $x } keys %hash; print "@keys\n";
      Will give you
      alice xavier Bob John
      Sorry about that... this thread is growing too fast for me to keep up!