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

for my $i ( 0 .. 4 ) { my $key = $sorted_keys[$i]; print "$hash{$key}\n"; }

or

for my $key ( @sorted_keys[ 0 .. 4 ] ) { print "$hash{$key}\n"; }

or

my @values = @hash{ @sorted_keys[ 0 .. 4 ] };