How can I redirect the output of Perl's system() to a filehandle?
Posted
by syker
on Stack Overflow
See other posts from Stack Overflow
or by syker
Published on 2010-04-27T05:52:05Z
Indexed on
2010/04/27
20:43 UTC
Read the original article
Hit count: 373
With the open command in Perl, you can use a filehandle. However I have trouble getting back the exit code with the open command in Perl.
With the system command in Perl, I can get back the exit code of the program I'm running. However I want to just redirect the STDOUT to some filehandle (no stderr).
My stdout is going to be a line-by-line output of key-value pairs that I want to insert into a mao in perl. That is why I want to redirect only my stdout from my Java program in perl. Is that possible?
Note: If I get errors, the errors get printed to stderr. One possibility is to check if anything gets printed to stderr so that I can quite the Perl script.
© Stack Overflow or respective owner