0

Basicaly, I would like to launch the perl script and use it as a python fonction in my programme.

My perl script contain an user input

use strict;
use warnings;

print "\nCan you hear me ? (1/0) ";

my $choice = <STDIN>;
if ($choice == 1){
    print "\nYES";
}

I tried to us subprocess.run and subprocess.Popen with no success.

With subprocess.run, it print but doesn't wait the user's input.

PS: First post I something is missing just tell me ;)

1 Answers1

0
import os

output = os.popen('perl filename.pl').read()

It assign everything to 'output' except the user input, but you can always print out that again inside the perl script and then it will work.

TLeo
  • 76
  • 6