If you want to monitor the process, use
Proc::ProcessTable ( can be a cpu hog) or see
linux memory leak monitor and see how you can watch the process table. You also might be able to get the pid by having the spawned program echo out it's pid, or use getpid().