in reply to Print STDOUT and STDERR to file and to console

tee for output re-direction is a standard Unix tool, but doesn't normally exist on Windows. Very complex is both input and output teeing!

But the basic version to split output is not hard:

#!usr/bin/perl -w use strict; $|=1; #turn autoflush on #tee.pl sub usage () { print "TEE USAGE:\n". " program | tee outfile\n". " sends stdout from program to outfile\n"; exit; } my $filename = shift @ARGV; usage unless $filename; open (OUTFILE, ">", "$filename") or (die "Can't open OUTFILE: $!"); while (<>) { print; print OUTFILE; }
Yep, that's pretty much it. Open for append if you like.