http://www.perlmonks.org?node_id=312222


in reply to Re: ^\s not equal \S?
in thread ^\s not equal \S?

Well, I finally did it. I ++'d an anonymous post. Good answer. I was going to say something like:

[^\s\w] means neither spaces nor words, or, everything but spaces and words, where
[\S\W] means non-spaces AND non-words, and since a space is a non-word, the meaning is similar to "non-spaces and spaces".

However, ^\s and \S should be the same, so...

$phrase =~ s/[^\s*\w*]//g;
would do the same thing as...
$phrase =~ s/[\S]|[\W]|[^*]//g;

Update: No, it wouldn't. :: smacks self in head ::