
Kanji
User
Aug 16, 2000, 8:56 AM
Post #5 of 6
(417 views)
|
You need to be a little more consistent: you say the results are in apparent random order, but then turn around and say they're ASCIIbetically, which isn't anywhere near random in nature. To get alphabetically order, make the sort case insensitive. You prolly also want to sort numbers appropriately while you're at it ... <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> @sorted_values = sort { $hash{$a} <=> $hash{$b} || lc( $hash{$a} cmp lc( $hash{$b} ) } keys %hash;</pre><HR></BLOCKQUOTE> As Cameron pointed out, you could also use values %hash instead ... <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> @sorted_values = sort { $a <=> $b || lc( $a ) cmp lc( $b ) } values %hash;</pre><HR></BLOCKQUOTE>
|