... } else { # this is child code die "cannot fork: $!" unless defined $pid; # <-- ...