while ($new_sock = $sock->accept()) { # fork returns undef if it failed, zero if you are # in the child process and the kid's pid if you are # in the parent... thus, by checking the return value # of the fork you know if you are the parent or you # are the child... since in all other ways the two # are identical in their state and execution my $pid = fork; die "Couldn't fork: $!\n" unless defined $pid; if (!$pid) { # if you are the kid, then # DO STUFF # and then EXIT when done. That's right, you # were a process created to perform a certain # task, and you have performed it, so now exit. # if you DON'T exit, you'll just return to the # top of the loop. exit; } # if you were the parent, of course, you didn't go # into that if block, and you just quickly cycle # back around to the top of the loop } #### ------------ :Wq Not an editor command: Wq