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
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"