my %hash; my @array; foreach my $Item (@array){ $hash{$Item} ++; } foreach my $key (keys %hash) { # key is the values that would be in your new array }