RE: Sort hash by values

2001-06-18 Thread David Gilden
Thanks for all who helped with my Perl coding, I thought some folks here might benefit from me posting the final code I used on a current project: ---snip--- if ($sort_order == 1) { # sort by name (front part of the key) foreach my $key (sort {lc($a) cmp lc($b)} keys %index){ &print_ta

RE: Sort hash by values

2001-06-14 Thread Wagner-David
[EMAIL PROTECTED] Subject: RE: Sort hash by values Use of keys, map and sort (untested) foreach my $subject (sort {lc($a) cmp lc($b)} map {[ $_, $subjects{$_}]} keys %subjects){ printf "%-40s: %-s\n", $subjects{$subject->[0]}, $subject->[0]; } Wags ;) -Original Message- F

RE: Sort hash by values

2001-06-14 Thread Wagner-David
Use of keys, map and sort (untested) foreach my $subject (sort {lc($a) cmp lc($b)} map {[ $_, $subjects{$_}]} keys %subjects){ printf "%-40s: %-s\n", $subjects{$subject->[0]}, $subject->[0]; } Wags ;) -Original Message- From: David Gilden [mailto:[EMAIL PROTECTED]] Sent: Thursday, J