RE: create log as well as print on screen

2003-08-21 Thread Marcos . Rebelo
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

RE: create log as well as print on screen

2003-08-20 Thread Jonathan E. Hogue
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

Re: create log as well as print on screen

2003-08-20 Thread Kristofer Hoch
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 "