As per this page : http://perldoc.perl.org/functions/fork.html, fork() "returns the child pid to the parent process, 0 to the child process, or undef if the fork is unsuccessful", so you can tell which 'copy' you are currently in, as it were ...
Sort of like this
# Fork new process
$pid = '';
if( $pid = fork() )
{
# Parent proc
}
elsif( !defined $pid )
{
exit_with_error("Can't fork: $!");
}
# ... else we are the child, call exec.
Cheers
Chris