Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: capturing program output

by BlaisePascal (Monk)
on Aug 24, 2000 at 23:33 UTC ( [id://29518]=note: print w/replies, xml ) Need Help??


in reply to capturing program output

open $FH, "myprogram here |";
I think that'll do what you want. The output of myprogram should be available on the $FH filehandle.

If I'm wrong, other's will correct me soon enough...

Replies are listed 'Best First'.
RE: Re: capturing program output
by merlyn (Sage) on Aug 24, 2000 at 23:35 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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://29518]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-26 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found