in reply to RE: RE (tilly) 2 Locking a script
in thread Locking a script

That would work, in fact try IPC::Semaphore.