## assuming my %hash = ( John => 20, Bill => 34, # etc... ); ## sort by name(key): foreach my $name ( sort keys %hash ) { print "$name: $hash{$name}\n"; } ## sort by number(value): foreach my $name ( sort { $hash{$a} <=> $hash{$b} } keys %hash ) { print "$name: $hash{$name}\n"; }
In reply to Re: Re: Re: Keys/Values being lost with this code--any help?
by lestrrat
in thread Keys/Values being lost with this code--any help?
by ByteOrNybble
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |