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
> 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()
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
> perldoc -f external
Tad, you are really getting old :-)
No documentation for perl function 'external' found
> How can I capture STDERR from an external command?
s/-f/-q/
jue
> 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--
--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
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 ...
>> How can I capture STDERR from an external command?
... 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.
> s/-f/-q/
Hey! None of that around here.
This is a family newsgroup.