The "Think DeMorgan . . ." statement says it. A []-defined character class is structured like logical "or", so a character matching [\D\W] is either in \W or in \D (That's actually a degenerate example since \w contains \d). So [^\d\w] is logically "not (d or w)". DeMorgan distributes "not" over "or" as "(not d) and (not w)", while [\D\W] translates as "(not d) or (not w)".
After Compline,
Zaxo
In reply to Re: Explanation requested regarding negation of characters classes in perlretut
by Zaxo
in thread Explanation requested regarding negation of characters classes in perlretut
by Anneq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |