my $temp; # Global variable if($pid) { print redirect(); exit; } else { # call the computation function in child }