use Proc::Fork; run_fork { child { # child code ... } parent { # parent code ... } };