in reply to Strange flock results?
You could also try opening the file in append mode, which instructs the OS to take care of this for you. If you want to truncate the file immediately after opening it, you can use truncate:sub lock { flock(MBOX,LOCK_EX); # and, in case someone appended # while we were waiting... seek(MBOX, 0, 2); }
open (BADADDR, ">>badmails.csv") || die; truncate (BADADDR,0) || die; open (GOODADDR, ">>goodmails.csv") || die; truncate (GOODADDR,0) || die;
|
|---|