if (!defined($child_pid = fork())) { die "cannot fork: $!"; } elsif ($child_pid) { # I'm the parent } else { # I'm the child }