use IO::CaptureOutput qw/capture_exec/; my ($stdout, $stderr) = capture_exec( 'command', 'with', 'args' );