use strict; use warnings; use MCE::Child; use Time::HiRes qw(sleep time); STDOUT->autoflush(1); # do something periodically in the background my $child = MCE::Child->create(sub { while (1) { MCE::Child->yield(300.0); print "Inside child ", time, $/; } }); # application code print "Parent", $/; # reap child $child->kill; $child->join;