in reply to Re: Selection of Hash key value pairs
in thread Selection of Hash key value pairs

A little shorter:

my @keys_to_print = (reverse sort keys %hash)[0 .. int(0.20 * (keys %h +ash))-1]; foreach my $key (@keys_to_print) { print_to_file($key, $hash{$key}); } sub print_to_file { # print to file }