1

I am working on Python 2.6.6.I looked at various examples but I am not able call perl script in Python with arguments. Perl takes couple of arguments and display it.I am new to both Perl and Python and might me missing some basic thing. I am able to call perl script without giving any argument but once I try giving any argument,It's not calling the perl script

Python :test.py

 import subprocess
 import shlex
 p=subprocess.Popen(['perl','start.pl','1','2'],stdout=subprocess.PIPE)

Perl :start.pl

use strict;
print "Called::\n";
my $name="$ARGV[0]";
print "$name\n";
my $next_name=$ARGV[1];
print "$next_name\n"

I am not sure how does perl takes the argument from python.Can someone please advice me where am I going wrong

1 Answer 1

2

There's one more step:

print(p.stdout.read())

The output of the Perl process is stored in the object p.stdout, not written to the console.

Sign up to request clarification or add additional context in comments.

1 Comment

Right . . . . .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.