#restore the file standard handles *STDOUT = $stdout; *STDERR = $stderr; close($fh); print "stdout 2\n";