Try this:
foreach my $key ( sort { $self->{_counts}->{$a} <=> $self->{_counts}->{$b} } keys %{ $self->{_counts} }
If you do $self->{_counts}{$b}, Perl thinks $self->{_counts} is a real Hash, not an HashRef. If you use the arrow to dereference, it is easier to read.
In reply to Re^3: Hash value sorting
by greengaroo
in thread Hash value sorting
by iHutch105
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |