Re: Windows paths in glob
am 31.03.2008 22:38:52 von Bart LateurDmitry wrote:
>Question: is there any way to use the same path string with glob and with the rest of Perl,
>without having to convert them back and forth?
Is a simple conversion acceptable?
If you put double quotes aroudn the path *in* the string for glob, then
it'll work.
($\, $,) = ("\n", "\t");
chdir 'c:/temp';
foreach('C:/Documents and Settings', 'C:\\Documents and Settings') {
print $_, glob(qq("$_")), -d $_ || 0;
}
Result:
C:/Documents and Settings C:/Documents and Settings 1
C:\Documents and Settings C:./Documents and Settings 1
Well, ok... the response of glob to a backslash *is* weird. But at
least, it seems to work.
--
Bart.