in reply to redirecting STDERR, then back again

search for the first part of your question by typing "dup STDERR" into the search box.

I presume that if you saved a copy of the filehandle you wanted to restore:

my $restore = \*original;
that you could use the dup method discussed in the posts you will find to restore it.