in reply to Re: Re: How to store the output of the process in my own array?
in thread How to store the output of the process in my own array?

I still meet a small problem. I input ls command, and then print @mylog, but it doesn't contain the result of ls.
The reason for the difference, is because ls detects whether it's connected to a pipe or to a TTY, and behaves differently for both cases. You have to fool it into believing it's connected to a terminal. The common way to do that, is to connect it to a pseudo-terminal.

To this end, you can use the module IO::Pty. And judging by the documentation, Expect (which I've never ever used in my life, sorry) ought to have support for it built-in.

Happy hunting.

  • Comment on Re: Re: Re: How to store the output of the process in my own array?