if you want to append to a second file then you should use ">>" when opening, not ">" or you will delete the text already there. if it was just a typo then ignore me.
On Mon, Oct 07, 2002 at 07:20:29 -0700, Timothy Johnson wrote: > > 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] -- Mat Harris OpenGPG Public Key ID: C37D57D9 [EMAIL PROTECTED] matthewh.genestate.com
msg31810/pgp00000.pgp
Description: PGP signature