in reply to Changing the name of STDOUT...

In the spirit of multiple ways to do things, add a simple function that uses select to choose a default output filehandle.

Inside that function, check for a $debug flag. If set, select STDOUT. Otherwise, select MAILPIPE.

You'll probably want to select STDOUT again after you're done, so you might have a generic printing method that combines the options.

Barring that, I'd recommend tilly's solution of a debugging module written to the same API. Why dup a filehandle when there are other options available that use less typing?