in reply to Capture return value from a cmd when it errors

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.