in reply to dumb question on exec and system ...

What if the program that you run wants to interact with the user?

What if you want the messages that your subprocess generates to go to your STDOUT (which, perhaps, is going to a log) as it is generated? (With `` you'll not get any output until the program has completely finished, so no partial progress information is provided.)

Both of these are good reasons to use system or exec instead of backticks.

  • Comment on Re: dumb question on exec and system ...

Replies are listed 'Best First'.
Re: Re: dumb question on exec and system ...
by ambrus (Abbot) on Apr 15, 2004 at 16:37 UTC

    And even if none of these stand, qx captures and saves the output in memory, thus it can eat too much memory unneccessarily if you discard the output. (A make command can have several megs of output to stdout.)

      And even if none of these stand, qx captures and saves the output in memory, thus it can eat too much memory unneccessarily if you discard the output.
      Uhm, no. Testing seems to indicate qx// is context aware, and doesn't store anything in void context. Running:
      perl -wle '`perl -le "print q!*! x 1_000_000 while 1"`'
      doesn't consume much memory, but running
      perl -wle '$_ = `perl -le "print q!*! x 1_000_000 while 1"`'
      quickly consumes all memory available.

      Abigail