I believe this is and old bug and has been fixed in later versions of perl. Checkout the p5p archive for info on your particular problem (perhaps this and this might be of some enlightenment). My advice would be to upgrade your version of perl.
HTH
_________ broquaint | [reply] |
Depending on how you do the system call and the backtick call,
there may be subtle differences in how perl and/or the sub-shell
are interpolating things that look like variables (or are not
interpolating things that you believe should be treated as
variables). It would be helpful if you could
post the actual system and backtick lines from your code,
along with any relevant snippets that assign values to any
variables involved.
| [reply] |
Specifically, when you use backticks or call system() with a scalar argument, the argument is passed to the system shell (typically /bin/sh). If you call system() with an array argument, the args are executed directly.
This has important security implications because the system shell will interpolate metacharacters. See 37385 for a more detailed explaination.
Try this and see if it works:
if (open(PROGRAM, "-|"))
{
# Parent process. Read output from child.
my @output = <PROGRAM>;
}
else
{
# Child process. exec() program
exec("/path/to/program", $arg1, $arg2, $etc);
}
-Matt | [reply] [d/l] |
system ("cat");
command actually creates a child process (a shell) and then calls the exec function , while
exec "cat";
by itself executes the string in the current shell , I think the backtick has the same difference with system | [reply] [d/l] [select] |