in reply to Logging to a filehandle of a deleted file

Ofcourse I could use (-e $filename) but there's always this chance that the file is removed between the test and the print.
It's worse that that. It is possible that another program not only deletes the original file, but creates another instance of it. So the name might exist in the directory, but pointing at a different inode to the one you are using.
Maybe you should check that the inode number hasn't changed, you can get the inode from stat (assuming you are on *nix).
  • Comment on Re: Logging to a filehandle of a deleted file