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 #### exec("R", "and", "some", "args"); # $pid will be the R command exec("R and some args > out"); # $pid will be that of a shell