How to call perl script from Python?
I am new with Python.
I want to know If I can run a Perl script from Python? Please give me an example for doing this if its possible?
Thanks in advance.
How to call perl script from Python?
I am new with Python.
I want to know If I can run a Perl script from Python? Please give me an example for doing this if its possible?
Thanks in advance.
Hi,
Do you have installed Perl engine & Python? Only python can't parse perl script.
If yes then its really easy. GO ahead.
Actually what I want to do is, pipe an email text which is in a tring to the perl script & store the result in another variable. IS this possible? Please let me know how to do so?
Can I use OS.system for this I hope I can but not sure actually.
My system only have Python.
Use subprocess. Here is the Python script:
And here is the Perl script:Code:#!/usr/bin/python import subprocess var = "hello" pipe = subprocess.Popen(["./x.pl", var], stdout=subprocess.PIPE) result = pipe.stdout.read() print result
Code:#!/usr/bin/perl use strict; use warnings; my $name = shift; print "hello $name!\n";
Bookmarks