in reply to empty a file

Just overwrite the file:
open HANDLE,">","/path/to/file" or die "Cannot overwrite file: $!"; print HANDLE "Whatever"; close HANDLE;
Will clear the file when the open statement executes, so you get an "empty" file to write to.

See perldoc perlopentut.

edit: typo in print statement fixed.

Replies are listed 'Best First'.
Re^2: empty a file
by GS (Acolyte) on Jun 27, 2004 at 16:16 UTC
    Forgot to mention that I am opeing this file in append mode.
    So I can not open it in write mode.

      perldoc -f truncate

      Ciao, Valerio

        Thanks , That's what I was looking for
      A reply falls below the community's threshold of quality. You may see it by logging in.