Need help with fork() on windows

Here is my sample perl program.

my $pid = fork();
if(! $pid )
{
      exec("perl sleep.pl 600");
} 
else
{
      print "PID ==== [$pid]\n";
      sleep 30;
      print "killing the PID [$pid] in 20 seconds\n";
      sleep 20;
      kill 9, $pid;
      print "Done ....\n"; 
}

The PID returns the pseudo process ID ( which is a negative number). When kill command sends 9 signal to the pseudo process ID, ( I assume the exec process ID falls under pseudo process ID) the exec process won't get killed.

Any help on how to kill the exec process on windows? I'm running this program on Windows XP.

Thanks In Advance
Hansini

Short version:

fork() is creating a new thread within the same process and returning that pseudo-process id. When you exec() from within that pseudo-process' thread, an actual new process with a different pid is created to run the exec()'d executable. The kill() is affecting the pseudo-process thread in the current process, not the separate process created by the exec().

Long version:
See the exec section @ perlfork - perldoc.perl.org

Regards,
Alister