child{ .....} #### use Proc::Fork; child { # child code goes here. } parent { my $child_pid = shift; # parent code goes here. waitpid $child, 0; } error { # Error-handling code goes here (if fork() fails). }; # Note the semicolon at the end. Necessary if other statements follow.