Don't focus on improving the performance of your program, as a solution for this. I am not saying you should not improving the performance of your program, but I am saying it is not a solution for this problem.
The point is that, whatever how fast your porgram is, there is still a chance that it is not fast enough for you to catch the file EVERY TIME, before it is gone.
I always believe that a solution has to a solution, not something that improves the chance.
I think you have to look at what you are trying to do again, and resolve this as a whole. Never waste your enegy on things, for sure, will not work all the time.
Synchronization is the way to go. However I don't know your entire story, and I cannot really help in the details, but thru your capable hands, nothing is unresolvable, but make sure go straight, don't be side tracked.
Comment on Re: fastest way to open a file and stroing it?
Thx, pg^^.
Just like you said, I gave up on trying to improve the performance of my program, but instead, I checked whether the file that I stored in the variable exists or not by using "-e $filename".
What you wrote was really helpful.
Thank you again.
snam