in reply to file used by process

From the docs of flock:
it waits indefinitely until the lock is granted
I doubt this is what you want!

However, check out the Fcntl module, it has a non-blocking version of flock.

A good introduction to file locking is Mark Jason Dominus' File Locking Tricks and Traps.

BTW: it is "Perl" for the language or "perl" for the interpreter, but is never, ever "PERL"!

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James