Keep a count of occurrences of each group in a hash.
Improve your skills with Modern Perl: the free book.
In reply to Re: Shorten a list... by chromatic in thread Shorten a list... by la