in reply to how to print top 5 elements from a hash
First of all, I don't know what you mean by "sorted". A hash is not going to be sorted unless it's tied, like Tie::IxHash.
What you are trying to do is fairly easy. What have you tried so far? We'd love to put in the effort to help you if you would be willing to put in some effort.
To get you started, I would approach this with the following steps:
1. Put sorted keys into @keys 2. Loop over the first five elements of @keys (many ways to achieve th +is) 3. Print those five records in the loop: print $hash{$key}
|
|---|