%common = map { lc $_, 1 } qw/ the and a /; @words = qw / hello Hello hello a The there /; # lowercase all the words @words = map { lc $_ } @words; # shorter: @words = map { lc } @words; # filter out common words @words = grep { !common{$_} } @words; # make a hash %words = map { $_, 1 } @words # get the sorted keys @words = sort keys %words;