in reply to How do you find the process ID to any UNIX programs that your Perl program executes?

In this case, if you would do an exec() instead of a meaningless ` ` construct (you're not doing anything with the captured output, in fact, you're redirecting all possible output to a file), you would know the pid, because it would be the value returned by fork().

Also, the open("|") type constructs return the child PID.

update: and loose the & at the end of the syscall, you've already forked off a seperate process.

update2: oh, I forgot. If you do pipes and redirect like you do, you're in fact starting a shell, which starts several other processes. So in fact, the only program started by perl would be the shell.

  • Comment on Re: How do you find the process ID to any UNIX programs that your Perl program executes?
  • Download Code

Replies are listed 'Best First'.
Re^2: How do you find the process ID to any UNIX programs that your Perl program executes?
by rzs96 (Acolyte) on Jul 12, 2005 at 16:40 UTC
    Hey Joost, thank you for your very swift reply. You really are a credit to PerlMonks!
    I got the PID at last! Let's see now if this solution will help solve the larger challenge...after lunch of course!
    Cheers! Robert