http://www.perlmonks.org?node_id=83655


in reply to Tacking a function on to STDOUT?

Try Filter::Handle. It does exactly what you're looking for. You can tie a sub to a file handle including STDOUT so that your text gets processed by the sub before being printed. That let's you use plain old "print", etc.