in reply to capturing STDERR within a script

You can probably use IO::Scalar to tie STDERR to a scalar variable. Something like this (untested):

use IO::Scalar; my $stderr; tie *STDERR, 'IO::Scalar', \$stderr;

Now anything written to STDERR will end up in $stderr.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg