If you want to append the contents of one file to another, then you will
have to open both files, read the first one, and write it to the second one.
Something like this should work:

######################

use strict;
use warnings;

open(LOG,"mylog.log") || die "Couldn't open logfile for reading!";
open(ARCHIVE,">>archive.log") || die "Couldn't open the archive file for
appending!";

while(<LOG>){
  print ARCHIVE $_;
}

open(LOG,">mylog.log") || die "Couldn't truncate logfile!";
close LOG;
close ARCHIVE;

#######################



-----Original Message-----
From: Steve [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 07, 2002 6:46 AM
To: [EMAIL PROTECTED]
Subject: File::Copy question


I am using Windows 98 and ActiveState Perl.  I have a log file that after a 
certain size is truncated and reused.  I have written a simple script to 
copy that file to another file using File::Copy.  Is there a way to make 
sure the second file is appended instead of overwritten, using File::Copy 
or do I need to use something else?


-----

The three most dangerous things are a programmer with a soldering iron, a 
manager who codes, and a user who gets ideas.

----

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to