in reply to Re: Top n Unique count from Array
in thread Top n Unique count from Array

UPDATE: Looks like I found the solution. This one is working for me:
my $top = 10; my %cnt_hash; $cnt_hash{$_}++ foreach @srcs; foreach $key (sort {$cnt_hash{$b} <=> $cnt_hash{$a}} keys %cnt_hash) { print "$key\t$cnt_hash{$key}\n"; $i++; if ($i == $top){last;} }