for my $job ( @jobs ) { my $pid = fork // die 'fork failed'; if( $pid ) { async{ waitpid $pid; }->detach; } else { dojob( $job ); } }