print "Yow!" if -t STDOUT; open SAVOUT, '>&STDOUT'; close STDOUT; open STDOUT, '>stdout.txt'; print "Yow!" if -t STDOUT;