The above will return...use strict; my @array = qw(foo bar foobar foobar bar bar bar bar foo foo foo foo b +ar foobar); my %hash; $hash{$_}++ foreach @array; print "Content-type: text/plain\n\n"; foreach (keys %hash) { print "$_ appears $hash{$_} times\n"; }
foobar appears 3 times foo appears 5 times bar appears 6 times
In reply to Re: How can I count and display unique items in an array?
by joshua
in thread How can I count and display unique items in an array? (was: array counting)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |