in reply to capture STDOUT, STDERR to TWO different perl variables

Probably goes without saying, but I figure I'll point out the obvious answer.

exec("shell.sh > stdout.txt 2> stderr.txt")

And then just read read each file.


The other obvious answer is
my $output = `shell.sh 2>&1`
but that won't separate out the stderr from the stdout.

Providing these solutions in case you don't have the module that was already suggested and you can't install the module.
  • Comment on Re: capture STDOUT, STDERR to TWO different perl variables