I am trying to write a form to file that is going to have a heavy load and I think I need to use flock to prevent the file being written to while operations are carried out on it. I have this code from the o'reilly book:<br><FONT FACE=monospace><br>$LOCK_SH = 1;<br>$LOCK_SH = 2;<br>$LOCK_SH = 4;<br>$LOCK_SH = 8;<br><br>sub lock{<br> flock MBOX, $LOCK_EX;<br> seek MBOX, 0, 2;<br>}<br><br>sub unlock{<br> flock MBOX, $LOCK_UN;<br>}<br><br>open MBOX, ">>/usr/spool/mail/$env{'USER'}" or die "Can't open mailbox: $!";<br><br>lock()<br>print MBOX $msg, "\n\n";<br>unlock();<br></font><br>But I don't know what any of the bit's do. Could someone explain this to me? Also, I need to apply a lock to my own specified file, rather than a mailbox.<br><br>Thanks<br>Will <p>fortytwo<br><a href=mailto:will@hellacool.co.uk>will@hellacool.co.uk</a><br><a href= test site</a><br>