use strict; my %hDat; my $d; map( $hDat{$_}++, ); foreach $d (sort keys %hDat) { print $d; } __DATA__ a b c dd c aa zzzz q r