in reply to Redirecting STDOUT

I know how to redirect STDOUT to a file

open (STDOUT, ">>myfile.log");
Works just fine for STDERR also!

To redirect into a variable, perhaps you can try

@LINES = <STDOUT>;