#!/usr/bin/perl use 5.24.0; # Book, Chapter and Verse use strict; # the First Commandment use warnings; # the Second Commandment use Digest::MD5 qw(md5_hex); # identity and volition use Math::Prime::Util ':all'; # the Tempter # provides 'todigitstring' and 'fromdigits' use MCE::Hobo; # the Family Unit my @children = ("Cain","Abel","Seth","Noah","Shem"); my $children = 5; my $birthorder = 0; # Set max_workers to limit # of workers running simultaneously. # Set posix_exit to avoid all END and destructor processing # inside the worker (ignored on the Windows platform). MCE::Hobo->init( max_workers => $children, posix_exit => 1 ); the_main_reason(); sub the_main_reason { printf "Forming $children children.\n"; foreach my $child (@children) { $birthorder++; print "Today, I have begotten child $birthorder as $child\n"; MCE::Hobo->create("begotten_child", $child) } # my longsuffering print "Waiting on begotten childen...\n"; MCE::Hobo->waitall(); } # the_main_reason sub begotten_child { my ($child) = @_; if ($child =~ m/cain/i) { the_task_I_gave_cain_to_do("Cain"); } elsif ($child =~ m/abel/i) { the_task_I_gave_abel_to_do("Abel"); } elsif ($child =~ m/seth/i) { the_task_I_gave_seth_to_do("Seth"); } elsif ($child =~ m/noah/i) { the_task_I_gave_noah_to_do("Noah"); } elsif ($child =~ m/shem/i) { the_task_I_gave_shem_to_do("Shem"); } # enable some prayer print "Child $child exiting\n"; MCE::Hobo->exit(0); } # begotten_child exit; ...