http://www.perlmonks.org?node_id=881245


in reply to How to run a shell script from a Perl program?

If you want the PID, STDOUT, and STDERR, use IPC::Open3.

Example:

use IPC::Open3; local (*IN, *OUT, *ERR); my $pid = eval{ open3( \*IN, \*OUT, \*ERR, 'my_command', 'my_command_args' ); }; if ($@) { warn ($@); } ## capture your output, if needed... ## wait on the pid... wait( $pid, 0 );