in reply to Restarting a daemon

You might want a fork/exec pair instead of the system call, which will wait until the launched process exits before returning.

I always have to look up what to do with $? after a system call, but I think perldoc -f system explains that you need to shift it right eight bits or so to find the real error number. In this case, it may be that the system call doesn't know what to do with a Perl program. It may not be marked executable or it may not be where you think it is.

I'd probably use $0 instead of hard-coding a path, but there may be security concerns there.