Like others above, I would recommend Inline::C as an "easy" way to do XS. There are some tricks you can even do to let vanilla perl handle your memory management -- see for example the snippet at
Pattern for Inline-C-based crunching. That snippet talks about using a packed perl string as the data source to pass data in to a C function, but the exact same technique could be used to get data out (if you know how big the result will be).
For example, if you knew you were passing in an array of 15 doubles and were getting back an array of 15 doubles (with the obvious extension if the sizes were not the same), you could do:
$inval = pack("d*",1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
$results = pack("d*",(0)x15)
$summary_result = c_function($inval,$results,15)
@real_results = unpack("d*",$results)
use Inline C => <<'END_OF_C_CODE';
double c_function(char * the_data, char * results,int nelems) {
double *real_data = (double *) the_data;
double *real_results = (double *) results;
double summary_result;
/* do your fast calculation here, storing elements in *real_resul
+ts */
return summary_result;
}
END_OF_C_CODE