in reply to Windows specific shell command calls

Backticks (and qx) capture the child program's STDOUT and return it. system leaves STDOUT alone. That's the difference.

As for Win32, you might also reconsider using Win32::Process, as it allows you to not wait for a program to finish. It'll launch a program, any program, like the shell would do — in particular, itr's a good way to launch Windows programs (like notepad).

Other interesting appoaches, that work well on Win32 too, include IPC::Open2, IPC::Open3, and IPC::Run. I'm sure I'm still missing a few more, interesting, options.

  • Comment on Re: Windows specific shell command calls

Replies are listed 'Best First'.
Re: Re: Windows specific shell command calls
by sonic (Acolyte) on Mar 27, 2004 at 03:35 UTC
    Is there no way to do both--catch both the error code and the output of the called command?
      Well, you can use backticks/qx to capture the STDOUT, and check $? for the exit code — which agrees with what system returns ... check perlvar for details in $?.