«That's why I used a shared variable to coordinate »
Your lock variable coordinates the concurrency between Perl Threads, it won't sync the OS File->writes, cos each Thread is using a cloned FileHandled and you are trusting OS Synchronization.
Now I make you a question? Why are you using a lock variable, since you are using a cloned FileHandle that is not shared between threads? You are trusting the OS sync, so the use of that shared LOCK variable is useless.It only minimizes OS->File->Writes thread concurrency
«A contentious debate is always associated with a lack of valid arguments.»