How do I remove all punctuation except for spaces from a st开发者_JAVA百科ring in Perl?
s/[[:punct:]]//g
Spaces aren't punctuation, and you aren't specific about whether you want to keep just spaces or all kinds of whitespace, but this substitution will remove all types of punctuation (since there are more forms of punctuation than just ! , and .).
$string =~ s/[[:punct:]]//g;
精彩评论