my $pid; defined($pid = fork()) or die "unable to fork: $!\n"; if ($pid == 0) { # child exec(...); # exec R script here die "unable to exec: $!\n"; } # parent continues here