I would like to call a Perl script with arguments from my Python program. so far I have been able to do it using subprocess and piping
#!/usr/bin/python
import subprocess
var = "world"
pipe = subprocess.Popen(["./x.pl", var], stdout=subprocess.PIPE)
result = pipe.stdout.read()
print result
#!/usr/bin/perl
use strict;
use warnings;
my $name = shift;
print "Hello $name!\n";
But as the name states, it's just piping the output.
What I need is the Perl script returning some value (for example here it would return the string instead of printing) and Python catching that value and using it.
I need to do this because the Perl script already exists and I'm trying to convert it from CGI (returns a value for each call) to Python (a Websocket server acts as proxy between the client and script)