in reply to Inconsistent system call from backticks vs system()

With backticks, you might have to add './' to the script name, in order for the shell to look in the current directory (do you have '.' in your path?)

With system(), using a list of parameters, perl doesn't go through the shell.

  • Comment on Re: Inconsistent system call from backticks vs system()

Replies are listed 'Best First'.
Re: Re: Inconsistent system call from backticks vs system()
by tilly (Archbishop) on Jul 01, 2003 at 14:48 UTC
    If the 2>&1 trick works, then he is going through the shell.
      If the 2>&1 trick works, then he is going through the shell.

      Actually, if the only "shell meta characters" in your command are a trailing "2>&1", then Perl will still avoid using the shell and simply redirect STDERR to STDOUT after it forks but before it execs.

      I think this feature was added to Perl fairly recently and I have yet to notice it having been documented.

                      - tye
        I find this very interesting. If anyone finds any more information about this, can they please post a reference to it.

        thanks.