Apart from the STDOUT typos above when redirecting STDERR, this approach is prone to dying if STDOUT or STDERR are already closed for some reason. Also, under wperl.exe on MSWin32, what you have may cause a segfault.
IO::CaptureOutput can deal with those kinds of edge cases for you.
Update: I misread the intent of the code example -- it's not a typo, it's merging STDERR and STDOUT intentionally.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In reply to Re^4: Capturing STDERR using IO::Handle
by xdg
in thread Capturing STDERR using IO::Handle
by rvosa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |