in reply to
writing in 2 handles
For the Windows challenged: This will do pretty much all that is to be done. *inx has a standard tee function.
# tee program
# quick tool by Marshall 7/2007
sub usage ()
print "TEE USAGE:\n tees stdout to a file and to stdout\n".
" program | tee outfile\n".
" sends stdout from program to outfile\n";
my $filename = shift @ARGV;
usage unless $filename;
open (OUTFILE, ">$filename")
or (die "Can't open OUTFILE: $!");
Adapt to your needs, re: different FILEHANDLES or use IO::Tee