Well, suppose my C program does this:

$ ./cprogram
First Name: Pete
Last Name: Emerson

I could use a Perl program like this to analyse the output:
The key is that the backticks execute any executable file and store the
output.

#!/usr/bin/perl -w

use strict;

my $cstuff=`./cprogram`;

my $first='';
my $last='';
if ($cstuff=~/First Name: (\S+)/) {
    $first=$1;
}
if ($cstuff=~/Last Name: (\S+)/) {
    $last=$1;
}

print "$first $last\n";

I'll leave the reverse case (C parsing Perl) to someone else, as it's no
longer about Perl.

        Pete


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to