old_script.pl | perl -e "while (<>) {print $_; warn $_}" 2> $logFile
Or redefine the print
-Original Message-
From: mark sony [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 20, 2003 3:11 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: create log as well as print on screen
Hi
In unix there is a program called tee.
It works something like
program.pl | tee log.file
you just have program.pl write to STDOUT
alternatively, in your program, you could just do
my $log = "log.file";
open( LOG, ">>log.file" );
print "THING\n";
print LOG "THING\n";
close LOG;
( basically pri
sub Log{
my $message = shift();
my $LOGNAME = 'log.log';
open(LOGFILE, ">>$LOGNAME") or die("Could not open log file: $!");
print LOGFILE $message;
close(LOGFILE);
}
sub Print{
my message = shift(); #Assuming you are passing a string
my $Out = *STDOUT; # Standard out.
print $Out "