in reply to Re: Unique elements in array
in thread Unique elements in array

Your code could be condensed to

my @set = qw(a a b c c); my %seen; my @unique = grep { not $seen{$_} ++ } @set;

That method preserves the order of the original array but if that's not important you could also do

my @set = qw(a a b c c); my %seen; @seen{@set} = (); my @unique = keys %seen;

I hope this is of interest.

Cheers,

JohnGG