1) Why don't you embed the Perl "interpreter" in the C application? See perlembed
2) Alternatively, it would surely be faster to launch a single Perl process and send the 40000 requests to it (via a pipe or whatever), rather than launching 40000 Perl processes (which requires compiling the script and the modules it uses every time).
3) Yet another possibility is to have the C program output a Perl program. This is particulary useful when each call to Perl is independant of the others. For example, the Perl script might look like:
use Guts;
guts(value_calulated_by_C_1);
guts(value_calulated_by_C_2);
...
guts(value_calulated_by_C_40000);
After running this one Perl script, the C program could process the output if need be.