sub new { my $self = {}; my $class = shift; bless($self, $class); $self->{'_counts'} = {}; return $self; } #### sub SortValues { my $self = shift; my $key; foreach $key ( sort{ ${self->{'_counts'}}{$a}} <=> ${self->{'_counts'}}{$b}} } keys %{$self->{'_counts'}}) { # Print out stuff } } #### #e.g for $a, $b would be the same ${${self->{'_counts'}}{$a}}}