my @list = qw(a b c d e a a b c d f g); # list with some duplicates my %h; map { $h{$_} = 1 } @list; print for sort keys %h; # sorting for clarity's sake #output abcdefg