我可以从perl脚本填充php数组吗?

I am trying to copy the contents of an array generated from a Perl script into an array on a PHP page. Is this possible?

Current code in PHP file:

$campaigns_array[][] = shell_exec('recent_campaigns.pl $companyID');

recent_campaigns.pl runs some mySQL queries and creates an array from it. I don't know how to get that array from the Perl script.

Thanks in advance.

The reply is either:

  1. parse the output and build the array from it, or
  2. modify the script so as to build a php string that you can eval, or
  3. dispense with the stupid script altogether and run the queries within php (after all, mysql connectivity is supposed to be one of PHP's strong suites)

Being more precise is hard, as you are not providing an output sample and are not saying if you have control on the script output, etc.

The easiest way is to output the result as json and then use json_decode to read it back in PHP.