in reply to Sync item list between perl scripts, across servers

For each system, create a subdirectory for use just by that system. When a thread picks up a filename, use rename to perform an atomic move of that file into the subdirectory for the system that the thread is hosted on. If the rename fails, then just skip that filename as the other system beat you to it.

Even better, when rename() fails, compare $! against ENOENT() from Errno. If you are on a Unix system, than you can check "man 2 rename" on your particular system to verify that ENOENT is the appropriate choice (but if you are on a Unix system, then I'm pretty sure it will be).

In the unlikely event that you are not on a Unix system and are not using MS Windows, then Perl's rename might not be atomic.

- tye