in reply to find maximum occuring element in a array
Looking for somethings like this? The List::Utils may also have a method for strings
#!/usr/bin/perl use strict; use warnings; my @strings = qw( QS DD DFD SD QS QS QS DD DFS); my %count; $count{ $_ }++ for @strings; my @sorted = (sort {$count{$a} cmp $count{$b}} keys %count); print pop @sorted, "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: find maximum occuring element in a array
by jwkrahn (Abbot) on Sep 07, 2011 at 17:47 UTC | |
by AnomalousMonk (Archbishop) on Sep 07, 2011 at 21:14 UTC |