in reply to Capture PID from child process on Windows.

The problem you are encountering is that fork creates a pseudo-process (a thread) and the "pid" returned is a (negative) threadid, not a process id.

The simplest way is to use the piped open, which spawns a real process and returns a real pid:

perl> $pid = open KID, 'perl -e"1 while sleep 1 |' or die $!;; perl> kill 21, $pid;; Terminating on signal SIGBREAK(21) perl> close KID;;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.