in reply to Capturing STDOUT and STDERR of system command, with pure perl?

For simple stuff, I've been very happy with IO::CaptureOutput. I use it extensively in testing CPAN::Reporter.

use IO::CaptureOutput qw/capture/; my ($stdout, $stderr); capture sub { system($command); } => \$stdout, \$stderr;

There is also a capture_exec command, but it does some sort of shell escaping which you may not want.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.