If you're using bash or a shell sufficiently similar to bash then you can redirect STDERR to STDOUT.
my @array = `cmd to be executed 2>&1`;
The advice Athanasius gave about Capture::Tiny is good advice, though. It should be much more portable to do it that way.
In reply to Re: Capture return value from a cmd when it errors
by mr_mischief
in thread Capture return value from a cmd when it errors
by sravs448
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |