Greetings

Short version: I have a perl-script with multiple variables I would like to output to php.

Longer version: I have a script that indexes specific data about a large number of files, and saves these in three different associative arrays. These array I would like to output to php, if possible maintaining their array-structure. I need to show different elements of these arrays as text to the user, and I am doing all this in a html-environment. I just like php so much better that I do <?php ...?> whenever I get the chance ;-)

Hope there is help out there.

Note that I have up until now used ' $output = shell_exec('index.pl')' and then printed with <pre>$output</pre>, but the problem is that the only way I can get this to work is by printing the array inside the perl script, thereby pushing them all together in $output. I need the separate arrays.

    To my knowledge, there is no way to retain the array structure. What I would do is convert the array to XML in Perl, pass that string to PHP, and then parse the XML in the PHP script. There might be a better (and more efficient) way but this would work in a pinch. And isn't that what Perl's all about? 🙂

      Thank you for the response, I have been working with it and reached the same solution: export all the arrays via print in perl to a string in php, including a unique separator, and then explode the string in php by the use of a for-loop.

      Now it is working as intended, but I am keeping the subject open a little while longer to see if anyone gets and epiphany.

        Write a Reply...