Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Sorting - lower to upper

by orderthruchaos (Scribe)
on Jul 15, 2004 at 17:02 UTC ( [id://374721]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://374721]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-25 18:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found