my $pid = fork(); die "Couldn't fork: $!" unless defined $pid; if ($pid) { # parent print "Location: $outpage_url\n\n"; } else { # $pid == 0 # child open STDOUT, ">>", "/path/to/some/logfile" or warn "Couldn't redirect STDOUT: $!"; open STDERR, ">>", "/path/to/some/logfile" or warn "Couldn't redirect STDERR: $!"; exec "$bin/somescript.pl"; exit; # just in case the exec failed }