in reply to fork-ing : my lack of understanding

First of all print `...`; is silly. Just use system.

foreach $row ( @{$ref} ) { my $pid = $pm->start(@$row->[0]) and next; system 'alert_main.pl', '-h', $row->[0], '-p', $passId; print "\n"; $pm->finish($row); }

Second, system ...; exit; is also silly. Just use exec.

foreach $row ( @{$ref} ) { my $pid = $pm->start(@$row->[0]) and next; exec 'alert_main.pl', '-h', $row->[0], '-p', $passId; $pm->finish($row); # In case exec fails. }

By using exec, you only fork once per row instead of twice. Unfortunately, that's probably not enough to get rid of your problem.

Replies are listed 'Best First'.
Re^2: fork-ing : my lack of understanding
by ethrbunny (Monk) on Jul 19, 2007 at 22:13 UTC
    I'll switch to 'exec' and give it another go-round. I figured this was inefficient but it was just a test to see if this concept would work.