Have you tried something like this?

#!perl

PrintAndLog ( "dir C:\\*.exe /s /b", "Log.txt" );

sub PrintAndLog{
     my $command = shift;
     my $log = shift;
     open (COMMAND,"$command|");
     open (LOG,">>$log");
     while (my $line = <COMMAND>){
          print $line;
          print LOG $line;
     }
     close COMMAND;
     close LOG;
}



                                                                                       
                                                    
                    "DePriest, Jason R."                                               
                                                    
                    <[EMAIL PROTECTED]>                       To:     
[EMAIL PROTECTED]                                    
                    Sent by:                                   cc:                     
                                                    
                    [EMAIL PROTECTED]      Subject:     Sending 
screen output to multiple output devices               
                    eState.com                                   simultaneously        
                                                    
                                                                                       
                                                    
                                                                                       
                                                    
                                                                                       
                                                    
                    09/21/01 01:19 PM                                                  
                                                    
                                                                                       
                                                    
                                                                                       
                                                    



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







_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to