in reply to cleaning out a file

Another easy way to do it would be:
unlink($filename); system("touch $filename");
touch is a standard unix command that updates the last-modified timestamp of a file. If the file doesn't exists, it creates it as a zero-byte file. It's a handy little thing to know, for testing purposes.

-- Kirby

Replies are listed 'Best First'.
RE: Re: cleaning out a file
by turnstep (Parson) on Apr 28, 2000 at 05:32 UTC
    Actually, 'touch' does a lot more than that. Most people only use it for its default behavior, but it can change the access and modification times to anything you want - which can be occassionally very useful. For the record, using a system("touch") is not very portable, especially when you can do the same thing in perl easy enough.