for(my $i=0; $i< @hosts; $i++){ $pm->start($hosts[$i]) and next; system(@some_command); $return_code = $? >> 8; $pm->finish($return_code); } #### use POSIX qw( _exit ); for(my $i=0; $i< @hosts; $i++){ $pm->start($hosts[$i]) and next; system(@some_command); $return_code = $? >> 8; _exit($return_code); } #### for my $host (@hosts) { $pm->start($host) and next; exec(@some_command); } #### for my $host (@hosts) { $pm->start($host) and next; exec(@some_command); print(STDERR "exec failed: $!\n"); _exit($!); }