in reply to Re^2: File locking
in thread File locking

If you lock a file for writing, it will automatically wait untill any other lock is released. In other words you can do this in both processes and it'll work:
use Fcntl qw(:flock); # import LOCK_* constants open F,">>",$somefile or die $!; flock(F,LOCK_EX); # lock exclusively - waits for lock # write stuff here close(F); # close() will release the lock.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.