in reply to Re^2: Keeping a program running
in thread Keeping a program running

That's covered pretty well in the referenced man page for fork: it returns undef on failure, zero in the child process, and the child's pid in the parent process.