in reply to consecutive spaces in piped open

Make sure you are using ActivePerl Build 633. Several versions before 633 including sub-command invocation problems. I've had mixed experience with the use of Perl to invoke sub-commands that contain other the simplest of commands.

Internally, unless Perl decides to create the sub-command process itself, the command is passed to 'cmd /x/c <YOUR_COMMAND_HERE>'. Under certain circumstances, 'cmd.exe' is not bright enough to know that 'cmd /x/c echo "line with double spaces"' is not the same as 'cmd /x/c echo line with double spaces'.

Using ActivePerl 633 on WIN XP I am not able to reproduce your particular problem. I do recall having similar issues in the past. If you can't fix the problem by upgrading, another alternative would be to create the process explicitly using Win32::Process, effectively avoiding cmd.exe altogether.

Replies are listed 'Best First'.
Re: consecutive spaces in piped open
by Woodya (Novice) on Dec 31, 2002 at 22:37 UTC

    Well, after much testing (and confusion with Win32::Process ;) I finally upgraded to build 633 and watched the whole ugly problem disappear. Best I can tell, it looks like MarkM's description of sub-command invocation problems was what I was really seeing. It looks like Perl didn't know when to stop parsing the arguments before passing them to cmd.exe.

    Thanks all for the help!