use IO::Tee; use IO::File; open(OLDOUT, ">&STDOUT"); open(OLDERR, ">&STDERR"); my $output_file = new IO::File(">tt1.out"); my $TeeOut = new IO::Tee(\*OLDOUT, $output_file); my $TeeErr = new IO::Tee(\*OLDERR, $output_file); open(STDERR, ">&", \*$TeeErr); select(STDERR); $| = 1; print $TeeErr "This goes to both STDERR and to the file.\n"; print STDERR "I would like this to do the same as above, but it goes nowhere.\n";