foreach $item ( @array ) { if( $pid = fork ) { print "Forking off to $pid\n"; } elsif( defined $pid ) { &proprietary_function( $item ); print "Done with function\n"; exit; } else { die "Can't fork: $!"; } } #### sub REAPER { my $waitedpid = wait; $SIG{CHLD} = \&REAPER; } #### if( $pid = fork ) { print "Forking off to $pid\n"; #### if( $pid = fork ) { $SIG{CHLD} = \&REAPER; print "Forking off to $pid\n";