http://www.perlmonks.org?node_id=214402

bitman has asked for the wisdom of the Perl Monks concerning the following question:

I need to run a dos program from Perl. Now the program string and the parameter have imbedded spaces, I am having problems with my escaping. I have tried all sorts of variations. Currently I have the executable working, but the parameter fails. This works :-
$ENV{TYPE}='c:\scotts test\type me'; $rc = system("\"$ENV{TYPE}\" c:\\test.bat");
This fails :-
$ENV{TYPE}='c:\scotts test\type me'; $new_debug_log='c:\scotts test\type me.bat'; $rc = system("\"$ENV{TYPE}\" \"$new_debug_log\"");
type me.bat contains
@echo off @type %1
It's driving me - crazy