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


in reply to Lock File

Use flock.