Record Output From System()

O

OttawaTrade

I need a perl script to call another script. I current use

system ("perl script2 ...");

However, I need to take the output of the script2 and do regexp on it.
Currently, it is just going to standout, and not returning to script1.

Is there a way to solve this?
 
P

Paul Lalli

OttawaTrade said:
I need a perl script to call another script. I current use

system ("perl script2 ...");

However, I need to take the output of the script2 and do regexp on it.
Currently, it is just going to standout, and not returning to script1.

Is there a way to solve this?

Please check the Perl FAQ *before* posting!

perldoc -q 'output of a command'
Found in /opt/perl/lib/5.6.1/pod/perlfaq8.pod
Why can't I get the output of a command with system()?

Paul Lalli
 
A

A. Sinan Unur

Please check the Perl FAQ *before* posting!

perldoc -q 'output of a command'
Found in /opt/perl/lib/5.6.1/pod/perlfaq8.pod
Why can't I get the output of a command with system()?

Or even just the docs for the function itself:

perldoc -f system

Sinan
 
J

Jürgen Exner

OttawaTrade said:
I need a perl script to call another script. I current use

system ("perl script2 ...");

However, I need to take the output of the script2 and do regexp on it.
Currently, it is just going to standout, and not returning to script1.

Is there a way to solve this?

Why don't you just follow the advice given in the documentation of the
function that you are using?
See third paragraph, fourth sentence of "perldoc -f system".

Or see the FAQ: "Why can't I get the output of a command with system()?"
Or just see DejaNews aka Google because this question is asked really
frequently.

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top