I am sure there is a better, more elegant, way to do this (perhaps with a module), but here is one way to do it
$print = sub {print LOG $_[0];print $_[0]};
open LOG,">output.log" || die "I can't create logfile.\n";
&$print("Foo Foo Fooey.\n");
&$print("Bar Bar Barcode.\n");
close LOG
John
"DePriest, Jason R." wrote:
Hello,
Is there a simple way to have perl text output print to STDOUT and to a log file at the same time?
The different methods I have tried don't work exactly right all of the time.Thank you!
Jason R DePriest, GSEC, GCFW
Intranet Web Administrator II
voice - (901) 523-5975
fax - (901) 523-5527
