It might be worth pointing out that re-opening STDOUT within your perl script will only affect stuff printed by that perl script and not the output from programs you spawn from within your perl script using system. They have their own set of file handles which are independant of those in your script.
There are three main ways of capturing the output from a spawned command.
open IN, "cmd args |" or die $!; while( <IN> ) { # do something with each line of input } close IN;
The latter form can be convenient if your command produces a large volume of output but you only need a few or selected lines.
In reply to Re: Reading from STDOUT after Redirecting it.
by BrowserUk
in thread Reading from STDOUT after Redirecting it.
by Dru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |