First, numerically:
and now lexicographicallyfor my $x(sort {return $hash{$a} <=> $hash{$b}} keys %hash) { print "$x = $hash{$x}\n"; }
for my $x(sort {return $hash{$a} cmp $hash{$b}} keys %hash) { print "$x = $hash{$x}\n"; }
In reply to Re: SORT ASSOC ARRAY
by snax
in thread Sort assoc array
by rowhiteny
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |