in reply to Substitute \W but not \.
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Substitute \W but not \.
by mr_mischief (Monsignor) on Mar 12, 2008 at 22:10 UTC |