cyberconte has asked for the wisdom of the Perl Monks concerning the following question:
However i've run into the situation where the program i need to run for a particular script prints a tremendous amount of output. (I'm talking on the magnitude of hundreds of megabytes). I've never bothered myself with the details of backticking, however now its an issue. even in a`program args`
loop, perl aparently stores all of the data internally and waits for the program to finish before acutally starting the loop. This is unacceptable in this situation, as it will easily bring the system to its knees.while(`program args`)
to aleviate this strain, but is this really the best way of doing it? Has anyone else run into this problem in the past, and how was it handled?open PROG "program args |" while (<PROG>) { ... } close PROG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: External program with large amounts of output
by Juerd (Abbot) on Apr 15, 2002 at 13:31 UTC | |
|
Re: External program with large amounts of output
by Fletch (Bishop) on Apr 15, 2002 at 13:53 UTC | |
|
Re: External program with large amounts of output
by strat (Canon) on Apr 15, 2002 at 14:47 UTC | |
by grinder (Bishop) on Apr 15, 2002 at 15:14 UTC | |
by strat (Canon) on Apr 15, 2002 at 15:44 UTC | |
by Bird (Pilgrim) on Apr 15, 2002 at 18:41 UTC |