if we open the file with > symbol then it will Truncate (erase) the contents before writing.
open( FILEHANDLE, ">filename.txt" ) or die "filename.txt: $!";
Otherwise,
If you are using BASH as a shell, run this:
echo -n > file
Other shells will use:
echo 'c' > file
Gentoo