map {s/[^a-z ]//gi} @words; #### my $x = " aabbaaccaa " ; $x =~ s/[^a-z ]//g ;