note
tye
<p>
The documented MS C RTL quoting rules (that not all Win32 programs follow, unfortunately) say that to get <<c>bar " baz</c>> you should write <<c>"bar \" baz"</c>>. The implementation is a bit weird, especially if you don't follow those rules. But your case doesn't work for me:
</p><c>
C:\> perl -le"print '<',$_,'>' for @ARGV" "foo "" bar"
<foo ">
<bar>
C:\>
</c><p>
Note that \ only "escapes" when in a construct matching <c>/\\+"/</c> (an even number of backslases results in $n-1 backslashes, an odd number in $n-1 backslashes followed by a quote).
</p><p>
This pointed out a subtle bug in the "current" Perl quoting that is done:
</p><c>
system(
$^X,
'"-leprint qq(<$_>) for @ARGV"',
"\\root\\subdir\\",
"\\root dir\\sub dir\\",
);
produces:
<\root\subdir\>
<\root dir\sub dir">
</c><p>
The fact that I had to quote and be careful with that second argument is the not-subtle short-coming. But the fix for it also fixes the final \ turning into a ".
</p>
<div class="pmsig"><div class="pmsig-22609"><p align="right">
- [tye]<tt> </tt>
</p></div></div>
605706
605766