{ local (*SAVEERR); open SAVEERR ">&STDERR"; # ... do your stuff open STDERR, ">&SAVEERR"; }