my $prev; @out = grep "$prev" ne ($prev = $_), sort @sd; # not for production code