in reply to Output capturing trouble
Backticks only capture STDOUT, not STDERR. For that, you can look at various approaches for capturing STDERR in perlfaq8 or use IPC::Open3.
However, I often recommend IPC::Run3 instead, as it's portable and makes things easy. This will capture both STDOUT and STDERR to the $output variable.
use IPC::Run3; my $output; run3("unzip -P $password $zipfile", undef, \$output, \$output);
-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.
|
|---|