in reply to STDOUT, STDERR sniffer

You reopen each handle to do what you want, for instance in 5.8 you can easily capture to variables,

my ($output, $messages); { open local(*STDOUT), '>', \$output or die $!; open local(*STDERR), '>', \$messages or die $!; # ... }
If you prefer, you can open to disk files instead in any version of perl. To capture to variables in earlier versions of perl, you must use IO::Scalar or similar.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: STDOUT, STDERR sniffer
by Anonymous Monk on Jul 21, 2004 at 14:59 UTC
    This code causes 2 uninitialized warnings:
    Use of uninitialized value in open. Use of uninitialized value in open at ./a.pl line 8.
    the two errors are from the two open calls.
    how can i make the warnings go away ?