Hi -
Try ...
use strict;
use warnings;
my %hash = (a => 1, b => 2, c => 3,);
# use the reverse keyword
print "$_\n" for (reverse sort keys %hash);
# reverse $a and $b
print "$_\n" for (sort { $b cmp $a } keys %hash);
Aloha => Beau.
-----Original Message-----
From: Barry Jones [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 8:23 AM
To: [EMAIL PROTECTED]
Subject: Reverse sort?
How can I sort a hash's keys in reverse order?
Barry Jones
DATABUILT, Inc. The Global AEC Information Company
1476 Fording Island Rd. Bluffton, SC 29910
(843) 836-2166 office
"Life is like a dogsled team;
if you ain't the lead dog, the scenery never changes."
- Lewis Grizzard
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]