> Hi all, > > Please tell me how could I fork more child processes. > I want to fork let's say 10 child processes. > > I know that I can do something like the following, but I am wondering if > there is a clearer method: > > if (my $pid = fork) { > #parent > > if(my $pid2 = fork) { > #parent 2 > > if (my $pid3 = fork) { > #parent3 > } > elsif(defined $pid3) { > #child3 > } > } > elsif(defined $pid2) { > #child2 > } > } > elsif(defined $pid) { > #child1 > } > > But this method is very confusing if I want to fork more child processes, > and I want to let the user choose how many processes wants. > > Thank you. >
How about a loop? Storing the PIDs to an array/hash? Are you really forking processes from a CGI script? http://danconia.org -- Boycott the Sugar Bowl! You couldn't pay me to watch that game. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>