use threads::lite; my $factory = threads::line->new( -threads => 10 ); #reserve 10 threads my $x_thr = $factory->create( \&doX, \@Xargs, \%optional_configs ); my $y_thr = $factory->create( \&doY, \@Yargs );