Well, ignoring shell solutions, you could use the Filter module.
Something like this at the beginning of your script.
use Filter::Handle qw/subs/;
open (*FH, ">OUTPUT_PATH/filename.txt") or die "Could open filename.tx
+t:$!";
my $output_file = *FH;
Filter \*STDOUT, sub {
print $output_file $_;
};
This code is untested. I hacked it from an internal program I wrote a while back that does what
your asking. Let me know if you have problems.
Update: Left out comma, duh. Fixed it.
-Lee
"To be civilized is to deny one's nature."