Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: doublequoted commands inside backticks on windows, perl 5.6

by emgrasso (Novice)
on Oct 28, 2004 at 18:56 UTC ( [id://403493] : note . print w/replies, xml ) Need Help??


in reply to doublequoted commands inside backticks on windows, perl 5.6

I'm still not sure why the problem is happening, but the workaround seems to be to provide an outer set of matched double quotes for Windows and Perl to munch on.
$cmd="\"\"c:\\path\\cleartool\" -fmt \"%[owner]p\" vob:.\""; `$cmd`;
seems to work, possibly because the double quotes that get eaten (the first and last encountered) belong to the same matched set instead of different pairs. I'd do something cleaner, like
$cmd=qq(""c:\\path\\cleartool" -fmt "%[owner]p" vob:.");
but I'm trying to do maintenance on some old code and get it working with the minimum changes possible. There are a lot of interpolations in the real string construction.

This problem showed up on Windows XP, by the way. But I wouldn't be surprised if other MS Win flavors did the same thing.