P is for Practical | |
PerlMonks |
find maximum occuring element in a arrayby capriguy84 (Novice) |
on Sep 07, 2011 at 16:17 UTC ( [id://924618]=perlquestion: print w/replies, xml ) | Need Help?? |
capriguy84 has asked for the wisdom of the Perl Monks concerning the following question:
Is there a module or function available to parse an array and return the maximum occuring element in a list?
Example:
@array = qw( QS DD DFD SD QS QS QS DD DFS)
How can I get QS as result? The elements cannot be put as a dictionary to set counters against them, so is there any ready solution available rather than parsing one by one and getting the result?
To add to that, if there is a tie, it should return all the values tied.
Thanks,
Back to
Seekers of Perl Wisdom
|
|