in reply to how to print top 5 elements from a hash

my $counter = 0; foreach my $key ( sort keys %hashname ) { $counter++; print " key ==> value number $counter : " . "$key ==> $hashname{$key} \n"; if ( $counter == 5 ) { last; } }
  • Comment on Re: how to print top 5 elements from a hash