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"; } [download]
or
for my $key ( @sorted_keys[ 0 .. 4 ] ) { print "$hash{$key}\n"; } [download]
my @values = @hash{ @sorted_keys[ 0 .. 4 ] }; [download]