File locking in Perl is usually done using the flock function. Unfortunately, this only allows locks on whole files and is often implemented in terms of the flock system function which has some shortcomings and slightly different behaviour than fcntl. Using this module file locking via fcntl(2) can be done