in reply to Running a C Program within Perl.

Basically, there are three ways to run an external prog - 1 - system. 2 - backticks. 3 - open a pipe.

system:
my $cmdToRun = "/path-to/the-c-prog"; system ($cmdToRun) && die "system $cmdToRun - $!\n";
'system' just returns 0 on success and 1 on failure therefore you should test for it.

backticks:
my $cmdToRun = "/path-to/the-c-prog"; my @results = `$cmdToRun`;
Using backticks is useful if you need to capture output from the program you are calling.

pipe:
my $cmdToRun = "/path-to/the-c-prog"; open (CMD, "$cmdToRun |") || die "open $cmdToRun - $!\n"; while (<CMD>) { # loop through the program output here... }
UPDATE Of course this assumes you meant calling an external c prog from within perl. After reading sniper's post I realize you could have meant running actual c code from within perl - in that case Inline.pm would be the natural choice.