in reply to Unlink or rename?
If you don't care for the old data why are you opening the file in append mode? Use '>' for opening file. You have also incorrectly written my where only file name should be. There is no value of a keyword inside double quotes if you are not evaling it. It should be something like
open(my $OUTPUT, '>', "file.txt") or die $!;Don't forget to close the handle
close($OUTPUT)Update: As pointed by hossman and Anonymous Monk below, "my file.txt" has no problem as a file name. My assumption was that you were expecting a file named "file.txt"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Unlink or rename?
by Anonymous Monk on Dec 22, 2010 at 06:48 UTC | |
Re^2: Unlink or rename?
by hossman (Prior) on Dec 22, 2010 at 06:49 UTC | |
by samarzone (Pilgrim) on Dec 22, 2010 at 07:00 UTC |