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


in reply to Re^2: Trying to get an external c program to print to a file
in thread Trying to get an external c program to print to a file

I mean that
system("$PGMEXEC1", "-arg1=$arg1", "-arg2=$arg2", ">${workingDir}${ps +}$outputFile1");
will not work, you have to use something like
system("$PGMEXEC1 -arg1=$arg1 -arg2=$arg2 >${workingDir}${ps}$outputFi +le1");
See system for the difference between the two.

If your variable arguments can contain spaces or other characters that are special for the shell, you'll have to escape them. If on Linux or another Unix-derivative, you can use the module String::ShellQuote to handle the hard work. If on Windows, just putting double quotes around the arguments should do, unless you're making life really hard on yourself. (You can wrap the whole command line in qq so you don't have to escape the quotes. Oh, you can't use single quotes there because the variables need to be replaced by their values.)