> foreach my $usr (@users) {
>       my $UsrPid;
>       unless ($UsrPid = fork) {
>             while fork {
>                   do stuff
>                   exit 0;
>             }
>             exit 0;
>        }
>        waitpid($UsrPid,0);
> } 
> if (defined @otherusers)
>       foreach my $usr2 (@otherusers) {
>             my $oUsrPid;
>             unless ($oUsrPid = fork) {
>                    while fork {
>                           do stuff
>                           exit 0;
>                    }
>                    exit 0;
>              }
>              exit 0;
>        }
>        waitpid($oUsrPid,0);
> }

What are you trying to do here? what is the distinction between @users and
@otherusers ?Not sure you need all this code. Did you want to include the if
(...) in the foreach loop ?

foreach my $usr (@users) {
       my $UsrPid;
       if ($UsrPid = fork) { exit }; #exit parent
         elseif ($UserPid) { do stuff .... }
       else { die "bad fork .. $!" }
       
# now, what do you want to with this ? waitpid waits for the child to exit
is 
# this  what you want to do ? or did you want the current child to go onto
your
# if statement below.      
        waitpid($UsrPid,0);
} 
> if (defined @otherusers)
>       foreach my $usr2 (@otherusers) {
>             my $oUsrPid;
>             unless ($oUsrPid = fork) {
>                    while fork {
>                           do stuff
>                           exit 0;
>                    }
>                    exit 0;
>              }
>              exit 0;
>        }
>        waitpid($oUsrPid,0);
> }


> 
>     This is in a sub routine.  But after it does stuff with $Usr it
> exists out of the sub and goes to the next one.  IT does not contiue
> with the if (define @otherusers).

THAT is because you code is telling it to that :-)



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to