This fixes two problems of repeatedly copying data from the C++ layer to perl, by factoring the copying out of an inner loop.
This fixes two problems of repeatedly copying data from the C++ layer to perl, by factoring the copying out of an inner loop.