$ perl -e 'my $prev; my @c = qw /a c d e r f e a e z e a /; print join " ", grep { $_ ne $prev and $prev = $_;} sort @c' a c d e f r z