in reply to calling C function from Perl
This is done using a Perl feature called XS. You should look at perldoc perlxstut and perldoc perlxs
"Perl makes the fun jobs fun and the boring jobs bearable" - me