if(my $pid = fork()) { #parent doParentStuff(); } elsif defined $pid { #child doChildStuff(); exit; } waitpid $pid, 0; #wait for child process to exit before going on in parent doMoreParentStuff();