in reply to Using map function to print few elements of list returned by sort function

AFAICS does your approach only work if population values are unique within a country, since you are using them as hash keys.

My approach for top 4 would be using slice of a sorted array @sorted[0..3] ... so no need for map.

Can't easily tell if this was mentioned already... That's the fundamental problem with one liners... ;)

HTH! :)

Cheers Rolf

( addicted to the Perl Programming Language)

  • Comment on Re: Using map function to print few elements of list returned by sort function
  • Download Code