unless(-t STDERR) { select STDERR; } [download]
In reply to use 'select' to change default output handle for entire script by richz