Both the cookbook and the perlopentut manual page will show
you how you can archieve what you want to do using open.
open (FH. "-|") will do a fork, and attach stdout of one
process to stdin of the other, which means you can process
your own output.
This requires no changes in existing code - all you need to
do is add the wrapper function. If you decide to no longer
process your output, all you need to do is remove the open.
No overhead of calling subroutines, or changes to the main
parts of your program.