in reply to Can't capture STDERR to Variable

Use Capture::Tiny or some other similar module.

File handles opened to scalar references can not be used outside the Perl process where they were created (and even then, most modules wrapping external C libraries will also fail to recognize them as valid file handles).