if (my $pid = fork()) { # do stuff in the parent } else { # do stuff in the child }