in reply to Re: Re: Re: spaces in filenames
in thread spaces in filenames
You are correct that "\W" produces a different result from /\W/ as a first argument to split(). You are not correct in concluding that this means split() is assuming that a quoted string is a literal. Examples:
$ perl -e '$t = "abc,def"; @t = split("\\W", $t); print "@t\n"' abc def
$ perl -e '$a = "abc,def"; @a = split("[^a-z]", $a); print "@a\n"' abc def
In both cases, the string is being interpretted as a regular expression. As a string, a different set of interpolation rules apply.
|
|---|