in reply to parallel functions

A new parallel module was recently added to CPAN called MCE. This is how one could run 2 functions in parallel using MCE.

#!/usr/bin/perl use 5.014; use MCE; my $mce = MCE->new( max_workers => 2, user_func => sub { my $self = shift; if ($self->wid == 1) { test1(); } else { test2(); } } ); $mce->run(); sub test1 { sleep 3; say "in test1"; } sub test2 { sleep 2; say "in test2"; }

Output

in test2 in test1