my %seen; print join '', grep { !$seen{substr($_, 0, 1)}++ } ;