in reply to Using perl to output a DOS batch file

You don't need to escape double quotes appearing between single quotes, because the only escape sequences in single quotes are \' and \\.

You can use another delimiter for your string to reduce confusion. eg, my $foo = 'bar'; qq{echo $foo\r\n};