tags:

views:

164

answers:

4

I have one script in Perl and the other in Python. I need to get the results of Perl in Python and then give the final report. The results from Perl can be scalar variable, hash variable, or an array.

Please let me know as soon as possible regarding this.

+2  A: 

You could serialize the results to some sort of a string format, print this to standard output in the Perl script. Then, from python call the perl script and redirect the results of stdout to a variable in python.

Sean Turner
+3  A: 

Take a look at PyYAML in Python and YAML in Perl.

Chas. Owens
+6  A: 

Use the subprocess module to run your Perl script to capture its output:

You can format the output however you choose in either script, and use Python to print the final report. For example: your Perl script can output XML which can be parsed by the Python script and then printed using a different format.

bedwyr
+2  A: 

Perhaps you want the answer to How can I read Perl data structures from Python?.

brian d foy