Re: system() help


#1

system() does not do anyting with stdout or stdin, and it returns true
or false depending on the command exit code. If you want to collect the
program’s stdin, the easiest way would be to use backquotes:

@myresult = ls

If you want to collect stderr as well, depending on you system shell you
can do something like:

@myresult = command_writing_to_stderr 2>&1

Or you can deal with forking and exec-ing a command explicitelly, using
pipe() and redirecting stdout/stderr anyway you like (you may also want
to take a look at popen()).

Gennady.