in reply to Using perl to output a DOS batch file

You have used single quotes which don't allow interpolation of variables or escapes so you get a literal \n rather than a newline. Since you also want double quotes in your output it will be easiest to use quoting constructs, qq{ ... } for double quotes. You may also want to include carriage returns if the target is DOS, I'm not sure if Perl takes care of this for you if built for that platform. You will have to double up the backslashes and escape the % sign inside double quotes.

my $outfile = q{mybatchfile.bat}; open( OUTPUT, q{>}, $outfile) or die qq{Can't open file $outfile : $!\n}; { print OUTPUT qq{\@echo off\n setlocal\n set PATHNAME=C:\\TEMP\\\%1_REGRESSIO +N\n}, qq{set WAIT_TIME=240000\n set URL="http://myurl.biz"\n}, qq{set PWD="megapassword"\nset EMAIL_TO_STRING="bob@test.com"}; }

I hope this is helpful.

Update: Thinking about it, your code might be a lot clearer if you use a HEREDOC.

my $outfile = q{mybatchfile.bat}; open( OUTPUT, q{>}, $outfile) or die qq{Can't open file $outfile : $!\n}; print OUTPUT <<EOT @echo off setlocal set PATHNAME=C:\TEMP\%1_REGRESSION set WAIT_TIME=240000 set URL="http://myurl.biz" set PWD="megapassword" set EMAIL_TO_STRING="bob@test.com" EOT

Also, I should have escaped the @ in the first code sample; corrected.

Update: Corrected typo - s{qotes}{quotes}

Cheers,

JohnGG