my %seen = (); my @unique = grep { ! $seen{ $_ }++ } @array;