You might want to check into IO::Scalar.
In reply to Re: Best Way to Redirect STDERR to a Scalar by Fletch in thread Best Way to Redirect STDERR to a Scalar by Mr. Muskrat