my @list = qw(some list of of non unique words); my %unique = (); foreach my $item (@list) { $unique{$item}++; }