in reply to Retrieving information from an executable program

Hi, you can get the result by using backquotes like:

my @output = `./retrive 2301`;

Then, you can use a regular expression to fill your variables:

my $cid=""; foreach (@output) { if ($_ =~/^CID: (.*)/) { $cid=$1; } }

If performance is an issue, you can precompile this regular expression so Perl doesnt have to do this every time in the loop. Here is a complete little program:

#!/usr/bin/perl use strict; use warnings; my @output = `./retrive 2301`; my $cid=""; my $r_regex = qr/^CID: (.*)/; foreach (@output) { if ($_ =~ $r_regex) { $cid=$1; } }