# .... # use perl to get your data into an array however suits # your needs (from a file, DBI, etc.) @array = (1,2,3,4,5,6,7,23); # for example # sample case where the C function is signed-int-based $packed_as_ints = pack("i*",@array); # note that with C and arrays, you need to pass the number # of elements along too $result = fast_c_function_int($packed_as_ints,scalar(@array)); # here is a sample case using doubles $packed_as_doubles = pack("d*",@array); $result = fast_c_function_double($packed_as_doubles,scalar(@array)); # etc. -- this technique can work for any primitive # datatype that can be represented natively (byte, short, etc) # see perldoc -f pack for the codes to pack to any of the # native data types (note where you need the "!" to force # native packing, though!) use Inline C => <<'END_OF_C_CODE'; double fast_c_function_int(char * the_data, int nelems) { int *real_data = (int *) the_data; double result; /* do your fast calculation here */ return result; } double fast_c_function_double(char * the_data, int nelems) { double *real_data = (double *) the_data; double result; /* do your fast calculation here */ return result; } END_OF_C_CODE