Well, \w = [a-zA-Z0-9_], so \W = [^a-zA-Z0-9_]. If you want to take the dot out of there too, make it [^a-zA-Z0-9_.].
$file =~ s/[^a-zA-Z0-9_.]//g;
Or use tr:
$file =~ tr/a-zA-Z0-9_.//cd;
In reply to Re: Substitute \W but not \.
by kyle
in thread Substitute \W but not \.
by sstevens
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |