[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: catch the output of an app in a perl script

On Fri, Dec 06, 2002 at 06:18:56PM -0600, Shyamal Prasad wrote:
>     "Michael" == Michael Naumann <mnaumann@giga-stream.de> writes:
>     Michael> On Friday 06 December 2002 12:56, Colin Watson wrote:
>     >> Use the "pipe open" syntax. The perlopentut man page will help.
>     Michael> Or even easier, use $output = `cmd`; or @output = `cmd`;
> It's been some years since I've done real perl programming (thank God
> for Python!), but the original poster might find it interesting that
> the "pipe open" syntax allows the program to read the output when it
> is ready. The backquotes require that the program have enough memory
> to collect the program output at one time. If there is a lot of
> output, that might be worth thinking about.
> Or have I completely forgotten perl?

No, you're right. I tend to reserve backquotes for "quick and dirty"
scripting - but this just illustrates that there's more than one way to
do it.

Colin Watson                                  [cjwatson@flatline.org.uk]

Reply to: