iphone has asked for the wisdom of the Perl Monks concerning the following question:
I open a file to append some data but the next time when the script runs I want this file to be deleted so that the data doesnt get appended to the already existing file.I know there is an unlink command but I read somewhere that renaming would be a best option?I want to get the fellow monks opinion on this.Please let me know your suggestions
open(my $OUTPUT, '+>>', "my file.txt") or die $!; if (@array) { print $OUTPUT "@array"; } if (@array2) { pprint $OUTPUT "@array2"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Unlink or rename?
by Anonymous Monk on Dec 22, 2010 at 06:38 UTC | |
Re: Unlink or rename?
by samarzone (Pilgrim) on Dec 22, 2010 at 06:39 UTC | |
by Anonymous Monk on Dec 22, 2010 at 06:48 UTC | |
by hossman (Prior) on Dec 22, 2010 at 06:49 UTC | |
by samarzone (Pilgrim) on Dec 22, 2010 at 07:00 UTC | |
Re: Unlink or rename?
by MishaMoose (Scribe) on Dec 22, 2010 at 12:49 UTC |