Hello All,
I am newbie .
waiting for your suggstions and guidance.
My requirement : I need to send the output of the system() command to
a file ,
Well, strictly speaking system() itself doesn't generate any output. To send
the output of the external command to a file just use the output redirect
command of your command shell to redirect the output to a file. Which symbol
that is depends on the command shell you are using, but very often a ">"
will work.
then extract a string from one of the lines in that file .How
can i do this.
You open() the file, read it line by line, and when you found the right line
exctact the string. Sorry, more detailed advice is not possible because you
didn't give us any details, either.
However, using system(), redirect the command output to a file, then reading
and scanning the file for a string is normally the wrong way to go.
Unless you need the external file for other reasons you will be way better
of using backticks or qx// to call the external program because those
commands will capture the command output and return it (details see "perldoc
perlop, section "strings"). Then all you have to do is to grep() the correct
line from the returned array and extract the string.
jue