Update: Changed to "spawn" without the "_each" suffix. Thank you, choroba.
I updated the prior example. Seeing "spawneach" made me rename it to "spawn_each". I can leave out the "_each" suffix, but preferred to be clear that "spawn_each" will be spinning a child process per each element.
# serial code
foreach my $i (30..38) {
say "$$: $i";
}
# this seems clear?
spawn_each my $i (30..38) {
say "$$: $i";
}
# will this confuse folks?
spawn my $i (30..38) {
say "$$: $i";
}
Which one do you prefer (spawn_each, spawn) or something else? The "spawn" without the "_each" suffix is elegant, but wonder if folks will think not spawning a child process per element.
MCE::Simple is quite nice. It does not alter the line count when filtering / transposing to parallel code.