in reply to Unable to redirect stderr to stdout

Hello suman583, and welcome to the Monastery!

I can’t test the Bourne shell, as I’m currently on Windows. But for a portable solution, use the module Capture::Tiny:

use Capture::Tiny ':all'; ... my ($stdout, $stderr, @results) = capture { ... };

Or, if you want the output to STDERR interleaved with the output to STDOUT:

my $merged = capture_merged { ... };

(But note the caveat in the documentation: “STDOUT and STDERR output in the merged result are not guaranteed to be properly ordered due to buffering.”)

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,