in reply to output from an external program

Is there a reason you had
open EXT,"|extprog"; while (<>)
rather than
open EXT,"|extprog"; while (<EXT>)
When I experimented against open EXT,"|ls" the first version gave the directory listing, but then kept waiting for input from STDIN, until I gave ctrl-d, whereas the second printed the file listings and quit out, which is (naively?) the behavior I expect.

Just curious!

Also, thanks for updating with your final solution.

Replies are listed 'Best First'.
Re^2: output from an external program
by olecs (Scribe) on Dec 08, 2005 at 09:43 UTC
    The reason was that I wanted to use data from STDIN and pipe it through extprog. When doing
    while (<>)
    the loop will run as long as data kept coming from STDIN, and all data will be piped into extprog inside the loop.
    This as opposed to doing
    while (<EXT>)
    which would require extproc to produce output for the loop to run. Since extproc requires input to produce output it would never run, atleast not the way my example was written.