{ local *STDOUT; open(STDOUT, "| tee $log_file") or die; print "Testing 1...2...3...\n"; } print "done!\n";