I have some perl that captures the output from a command, e.g.: $output = `$cmd`; I'd like to capture the output from stderr as well though, without redirecting stderr to a file on disk--I'd like to redirect it to an array. How would I do that?
IPC::Run3 lets you do this very easily.
use IPC::Run3; my ( @out, @err ); run3 [ $command ], undef, \@out, \@err; print map { "STDOUT = $_" } @out; print map { "STDERR = $_" } @err;
In reply to Re: Capturing stderr
by adrianh
in thread Capturing stderr
by Zadeh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |