in reply to Re: capturing program output
in thread capturing program output

Too much money, err, too many dollar signs. You want
open FH, "myprogram here |" or die "Cannot fork: $!"; ... while (<FH>) { ... look at $_ }

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE: RE: Re: capturing program output
by BlaisePascal (Monk) on Aug 24, 2000 at 23:38 UTC
    You are right, but I think it's really a matter of style...

    won't open $file,"myprogram here |" or die ... work as well, placing the filehandle reference in $file?

    Thanks for catching the lack of error-checking...

      Only in perl 5.6, in which it's a new feature. 5.5 didn't do that. (Unless you pre-populated the variable with a IO::Handle-ish object.) And it has to be a variable that only has undef in it. Otherwise, it's treated as a symbolic reference, which may not succeed if you have "use strict refs" turned on.

      -- Randal L. Schwartz, Perl hacker