in reply to overwriting a file

I don't think that should happen... You could unlink the file first, just to be sure.

BTW more infos on the file opening modes can be found in perlopentut