in reply to how many instances are running ?

To find a loophole in your specifications, the program could always flock the Perl file itself on receiving the -w parameter and unlock itself when done writing.

Alternatively, Proc::ProcessTable::Process can retrieve the full command line of all the processes.

-M

Free your mind