This question talks about using the system command and passing variables. Here is an example it gives:
system
string cmd(\"curl -b cookie.txt -d test=\
You can use environment variables to safely pass parameters to the comand executed by system(3)
system(3)
setenv ("mypar1", "'$(rm -rf /)", 1); setenv ("mypar2", "\"; rm -rf /", 1); system ("echo mypar1=\"$mypar1\" mypar2=\"$mypar2\");
Neither of these evil codes will be executed, simply printed.