use strict; use warnings; use diagnostics; use Parallel::ForkManager; my $pm = new Parallel::ForkManager(2); # This works pm->run_on_finish( sub { print "Hello!\n"; } ); # This doesn't #sub hello { print "Hello!\n"; } #$pm->run_on_finish( &hello ); foreach my $child ( 0 .. 4 ) { my $pid = $pm->start and next; $pm->finish; } $pm->wait_all_children;