use MCE::Loop; use MCE::Candy; my $shared = [ ]; MCE::Loop::init( max_workers => $CONFIG->max_workers_MCE, chunk_size => 100, gather => MCE::Candy::out_iter_array( $shared ), ); mce_loop { my ( $mce, $chunk_ref, $chunk_id ) = @_; my @items_to_gather; foreach my $item ( @{ $chunk_ref } ) { push @items_to_gather, $item; # your logic here } MCE->gather( $chunk_id, @items_to_gather ); } @list;