If the scalar already has a value, this doesn't work because Perl won't stomp on our data.
my $log_fh = 5;
open $log_fh, '>> castaways.log'
or die "Could not open castaways.log: $!";
print $log_fh "We need more coconuts!\n"; # doesn't work
它说不会有输出,实际上输出了"We need more coconuts!"到文本,$log_fh也成空值了。
谁能解释一下?