in reply to RE: Re: This is weird...
in thread This is weird...

I would only use flock if I wanted to access a file and keep any other bits of my program from doing so at the same time. If I thought there were a possibility that one bit could start writing to it, another would become active and start writing to it, that could result in a corrupted output file.

The problem is, flock tends to be advisory. If you really want to ignore a lock on a file, you can get around that.

In a small program like this, I don't bother with file locking. In larger programs, where there's an issue of concurrency, it does come up. (So do a lot of other things.)