The manipulation of STDOUT that you show is okay as far as I can tell.
Beyond that, without the code, there is no way to debug your problem,
and I'm not going to look at the original program if you've made
changes to it that could be problematic.
Therefore, please send the code and instructions on how to use it to:
jdhedden AT cpan DOT org
(1)
]
