in reply to Re^4: Is there a way to avoid copy function from overwriting old contents?
in thread Is there a way to avoid copy function from overwriting old contents?
Why do you use File::Copy? I tested your code and, to my surprise, copy does append to a file if you open it for appending and copy to the filehandle.
But it's not documented in the POD, and it only works as a side effect of how File::Copy deals with filehandles. Why not do as others have suggested:copy "file1", $fh
It's a couple of extra lines, but you can use all built-ins, obviating the need for an external module.if (true) { open (my $fh, ">> RESULT_LOG"); open BATTERY, "<Battery_Status"; print $fh <BATTERY>; close BATTERY; } else {print "Error"}
My two cents.
--marmot
|
---|
In Section
Seekers of Perl Wisdom