It appears to me that you are executing parent code in both the parent and the child.
I stripped your code down considerably and placed some print statements in there... Also added code so that it would work without the dbi stuff.
my @array = qw(1 2 3); my $switch_ref = \@array; for (my $count = 0; $count < @$switch_ref; ++$count) { my $switch = $switch_ref->[$count]; my $pid; if ($pid = fork) { push @pids, $pid; } elsif (defined $pid) { print "Child: $pid\n"; } else { die "Fork failed: $!\n"; } } foreach my $pid (@pids){ waitpid($pid,0); } print "parent: exiting.\n";
In reply to Re: forking and dbi
by Mr. Muskrat
in thread forking and dbi
by dlspinhir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |