This works.
use IO::File;
$fh = IO::File->new_tmpfile();
open(SAVE, ">&STDOUT") or die $!;
open(STDOUT, ">&${\fileno $fh}") or die $!;
$| = 1;
print "This text is going nowhere...\n";
print STDOUT "Neither is this...\n";
open(STDOUT, ">&SAVE");
close(SAVE);
print "STDOUT reopened.\n";
seek $fh, 0, 0;
while (<$fh>) {
print;
}
close $fh;