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