in reply to Re^3: Using map function to print few elements of list returned by sort function
in thread Using map function to print few elements of list returned by sort function
With your hint, I was able to do the following
perl -F':' -lane ' push @{$h{$F[1]}}, [$F[0],$_] }{ print $_->[1] for map { splice [sort {$b->[0] <=> $a->[0]} @{$h{$_}}], +0,4 } keys %h' file 20470:ZM:Samfya:Africa 20149:ZM:Sesheke:Africa 18638:ZM:Siavonga:Africa 699385:ZW:Bulawayo:Africa 61739:ZW:Chinhoyi:Africa 47294:ZW:Chegutu:Africa 37423:ZW:Bindura:Africa
Thanks LanX, your guidance was much appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Using map function to print few elements of list returned by sort function
by LanX (Saint) on May 26, 2014 at 11:24 UTC | |
by jaypal (Beadle) on May 26, 2014 at 15:16 UTC |