use Data::Dumper; my @array = ( 'a', 'b', 'c', 'a', 'b' ); # Iterate through array and increment hash element indexed # by the array element - As each hash element must be # unique, this allows for a count of each unique array # element to be easily generated. # my %hash; $hash{$_}++ for @array; print Data::Dumper::Dumper( \%hash );