1 use utf8; 2 open A, ">&STDOUT"; 3 open STDOUT, ">AA.txt"; 4 print STDOUT ‘AB‘; 5 open STDOUT, ">&A"; 6 binmode(STDOUT,":encoding(gbk)"); 7 print "你好\n";
先把A重定向到STDOUT,
之后的STDOUT不代表标准输出了
到最后用完了再恢复
时间: 2024-10-12 16:45:47
1 use utf8; 2 open A, ">&STDOUT"; 3 open STDOUT, ">AA.txt"; 4 print STDOUT ‘AB‘; 5 open STDOUT, ">&A"; 6 binmode(STDOUT,":encoding(gbk)"); 7 print "你好\n";
先把A重定向到STDOUT,
之后的STDOUT不代表标准输出了
到最后用完了再恢复