For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2006 > Capturing Output from a program









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Capturing Output from a program
olson_ord@yahoo.it

2006-01-10, 4:02 am

Hi,
I am working on Linux, and would like perl to execute a program i.e.
executable and capture the output. From what I have read - it seems
that I should not use the system() command, but I should use the
backticks. Assuming the location of the executable is
/home/masca/org/10/exe

I have something like



open(OUTPUT, `/home/masca/org/10/exe`);
while(<OUTPUT> ) {
print;
}


But nothing happens. If I directly place that on the commandline - it
works fine. I think that the program executes - but I get nothing in
OUTPUT.

I hope someone has some ideas. I am sure this must be simple - but I am
new to perl.
Thanks a lot.
O.O.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com