in reply to Undo a STDOUT redirect

perhaps:
print "stdout"; { local *STDOUT; open STDOUT, "> $logfile" or die $!; print "yo"; } print "stdout2";