die "fork: $!" unless defined ($pid = fork); if ($pid) { # this is the parent process # do something parental } else { # this is the child process # do something childish }