Well, here are the results of the first part of my tests.
1. First of all, it is not Perl interpreter who drops the error. It is Bash. I started my PL-script by simple calling it via ./my_script.pl, and when I changed it into explicit call of perl (/usr/bin/perl ./my_script.pl) the error no longer appears. However, it does not solve anything. I tried also to look through the source code of Bash interpreter to find the conditions on which it drops this error, but there was no such error message…
2. I tried to reproduce the problem using Notepad instead of EmEditor – but failed. I tried to do it about 30-40 times, and no error appeared, while with EmEditor it appears after approximately every 4-5 openings.
3. I tried to write a program that runs on the virtual machine and constantly tries to open and close the file with read-write access, and while this program was running tried to open the file in EmEditor – and again, no problem appeared. :-(
So, all this seems as if EmEditor during opening a file set a very specific lock, which causes Bash (and only Bash) to fail opening the same file at the same moment. After EE read the file into memory, it releases the lock, but it’s too late – Bash already failed to open the file.
Moreover, I also tried to set the option “Changed by Another Program” to “Keep Locked” – and even then the file was correctly opened and executed by Bash+Perl! So, the lock while opening a file and the lock after it’s opened are two completely different locks.
I’ll be trying further…