in reply to Re: Re: finding the most popular in array
in thread finding the most popular in array

It could be done in one loop too.
@a= qw(a b c d e c d e c d e c d e c d e a b c d a b c d a b c d a b c + d a b a b a e e d a a a a a a a a); for(@a) { if ($c<$r{$_}++) { $m=$_; $c=$r{$_} } }
And this is to check.
for (keys %r){print "$_ $r{$_}\n"}; print "\n\$m is $m\n\$c is $c";
Hopes
I hope you had enjoyed it