in reply to Re^4: empty a file
in thread empty a file

No, if you open with ">", it means "open a file for writing, creating a new file if needed or else truncating an old file" *) so amazingly, you can actually print to the file after you've opened (and cleared) it. You don't need to reopen with ">>" mode, because the only difference between them is that ">>" mode does not clear the file first.

Repeat after me: perldoc perlopentut is there for a reason.

*) sentence taken from perldoc perlopentut