in reply to Mysterious Disapperance of file contents

Oops, nevermind.

I beleive this is a race condition:

open(SEM, ">$semaphore_file") || die "Cannot create semaphore $semapho +re_file: $!"; flock(SEM, LOCK_EX) || die "Lock failed: $!";
I believe it's possible for 2 instances to execute the first line above at the same time, before either gets to the second.

--Bob Niederman, http://bob-n.com

All code given here is UNTESTED unless otherwise stated.