Reputation: 2613
I have a perl script that does a lot of config file parsing for me and creates a hash with all the information I need.
I want to call that script from PHP and have PHP get the hash to be able to work with the hash in php and not just returning some html code from the perl script.
Is that possible? Haven't found any way yet and just know that I am able to return lots of html code as output, but that's not what I want the perl script to do.
Upvotes: 1
Views: 495
Reputation: 373
If the platform that is executing the PHP allows for it, you can call the exec() function to execute external files like:
$result = exec( "/path_to/your_script.pl", $lines, $state);
Upvotes: 1
Reputation: 15036
The simplest way, serialize this hash into json
in perl and print resulting string to STDOUT.
In PHP it can be easily decoded into array or object...
Upvotes: 7