Tiago Martins
Tiago Martins

Reputation: 3

Run a program and capture its output

I have a Perl script that runs a python script but i need to pass information back to the Perl script. Anyone can help me to achieve this?

This is my code so far

open(my $py, "|-", "python2 /home/pi/myRead.py") or die "Cannot run Python script: $!";
while (<$py>) {
    $newCard = $py;
}
close($py);

Upvotes: 0

Views: 115

Answers (1)

ikegami
ikegami

Reputation: 385916

my $newCard = `python2 /home/pi/myRead.py`;

Upvotes: 3

Related Questions