in reply to
Fork daemon from Perl script and save it's PID. How to do it right?
It sounds to me like you're trying to do things with this program that it was fundamentally not designed to do. You want to control its processes manually from the outside, but it was clearly designed to handle them automatically internally. You want to separately manage multiple instances of it, but if it's an even vaguely typical Unix daemon (other than getty) it's probably either designed to only ever have one instance, or else to fork (or even prefork) as many processes as it needs automatically.
Perl and daemons are widely used, I don't believe that no one worked on this problem.
I think everything is working exactly as it was designed to work, but you're trying to change the design for how the program (the daemon) is supposed to work, and you want to do that without changing the program itself. Good luck with that.