in reply to Is there a better way to restore STDOUT ?
print "Should go to stdout.\n"; { local *STDOUT; open(STDOUT, ">afile.txt") or die "Couldn't open afile.txt: $!"; print "Should go to afile.txt\n"; } print "Should go to stdout.\n"; [download]