ricky has asked for the wisdom of the Perl Monks concerning the following question:

Hi there, I am new to Perl and have a very basic question. How can I make a C program to be executed from a Perl script? I ll appreciate your responses. Thanks, Ricky

Replies are listed 'Best First'.
Re: Executing C program from Perl
by broquaint (Abbot) on Apr 16, 2003 at 09:16 UTC
    If you want to capture the output of your program then you could use either backticks or open(). If however you just want to execute the program and are not concerned about the output then system() would be your best option e.g
    ## backticks my $output = `your_program`; ## alternate backtick syntax my $output = qx(your_program); ## open open(my $prog, "your_program|") or die("ack - $!"); my $output = join '', <$prog>; ## system system("your_program") == 0 or die("program exitted abnormally");

    HTH

    _________
    broquaint

Re: Executing C program from Perl
by Mr. Muskrat (Canon) on Apr 16, 2003 at 13:06 UTC