I only get the smaller element as output although there are 2 elements with same highest occurrence in array
I have tried to remove sort function from the codes but it still returns me the smaller element
my(@a) = (undef,11,12,13,14,15,13,13,14,14);
my(%count);
foreach my $value (@a) {
$count{$value}++;
}
$max_value = (sort {$count{$b} <=> $count{$a}} @a)[0];
print "Max value = $max_value, occur $count{$max_value} times\n";
Expected result: Max value =13 14, occur 3 times