my @set = qw(a b c a c); my %seen; my @unique = grep { not $seen{$_} ++ } @set; # http://www.perlmonks.org/?node_id=614322