# print cgi response as usual, then... my $pid; if ($pid = fork) { # display run, so exit exit(0); } elsif (defined $pid) { # run script b function if $run_script_b true... if ($run_script_b) { script_B(); } } else { # raise an error coz the fork failed ... }