Help: Filehandle problem

A

Amy Lee

Hello,

I want to process the output of a program. Anyway, the output is showing
on screen. Is there any way to process it by using file handle? I don't
suppose I should save the output as a file then process this file.

Thank you very much~

Regards,

Amy
 
T

Tad J McClellan

Amy Lee said:
I want to process the output of a program. Anyway, the output is showing
on screen.


How are you executing the process?

By using Perl's system() function perhaps?

If so, then let me read the docs to you yet again:

perldoc -f system

... This is I<not> what you want to use to capture
the output from a command, for that you should use...

Is there any way to process it by using file handle?


Yes, though there is an easier way, as above, without using a filehandle.

perldoc -f external

How can I capture STDERR from an external command?

There are three basic ways of running external commands:

system $cmd; # using system()
$output = `$cmd`; # using backticks (``)
open (PIPE, "cmd |"); # using open()
 
S

Sherm Pendley

Amy Lee said:
I want to process the output of a program. Anyway, the output is
showing on screen. Is there any way to process it by using file
handle?

Have a look at the "Pipe Opens" section in "perldoc perlopentut" for a
much better explanation than I could write here.

sherm--
 
T

Tad J McClellan

Jürgen Exner said:
Tad, you are really getting old :)


Yeah.

Thanks for reminding me.

Maybe I can do the same for you some day.

No documentation for perl function 'external' found


Ack! I used to copy/paste from the post to ...



.... get the question. But my terminal puts funny codes in it
so now I grep the indexes of the *.pod files that I made.

Looks like maybe I better start doing both.



Hey! None of that around here.

This is a family newsgroup.
 

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

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top