当我运行这个:
open FP, ">xyz";
my $file = *FP;
printf $file "first\n";
$file = *STDOUT;
printf $file "second\n";
open $file, ">abc";
print $file "third\n";
print STDOUT "fourth\n";
print FP "fifth\n";
Run Code Online (Sandbox Code Playgroud)
"第四"印刷品不是STDOUT,而是"abc".
STDOUT与FP的不同之处在于其表现如预期.
我究竟做错了什么?我不明白的是什么?