in reply to Clearing out the file
open the file for simple output (not for append, just plain old simple output). If the file open is successful, the file will be truncated, as per the POD: open.
{ open my $wipe_file, '>', $filename or die $!; close $wipe_file or die $!; #done }
It would be wise to lock the file beforehand so that you know nobody else is using it at the moment. ...doesn't seem prudent to obliterate the contents of a file that's currently being read by some other process, now does it?
At any rate, opening a file for output, by default, truncates the file to zero length.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Clearing out the file
by Anonymous Monk on Jul 25, 2006 at 07:51 UTC |