in reply to How do I lock a file in perl?

One thing to keep in mind with flock() is that it doesn't magically "lock" a file. If you flock() a file and another application tries to access it, the operating system will happily allow that.

The operating system just makes sure that no two flock()s are succeeding on the same file at the same time. Once one flock() succeeds, another flock() on the same file will block (unless nonblocking is selected) until the first one gets released.

"Locking" is actually a mutual agreement, not a draconic measure one party can impose.