You probably want to hash up the array contents, where the keys of the hash will be the unique set of array elements and the values will be the times that that element occurs. There are many ways to write this out .. here is the start of one -- printing of the hash is left as an exercise for the reader .. Be sure to look up these hash-related functions in the docs:
keys,
values,
each,
exists
use strict;
use warnings;
my %counts;
foreach my $key ( @myArray ){
$counts{$key}++;
}