If you specify '<&=N', where N is a number, then Perl will do an equivalent of C's fdopen() of that file descriptor; this is more parsimonious of file descriptors. For example: open(FILEHANDLE, "<&=$fd") #### # restore STDOUT my $fd = fileno($this->{'_stdout'}); open(STDOUT, ">&=$fd"); print STDOUT "STDOUT restored\n";