Perl autodie杂注对编码有影响吗?
为什么在“autodie”之后会得到不同的输出Perl autodie杂注对编码有影响吗?,perl,encoding,autodie,Perl,Encoding,Autodie,为什么在“autodie”之后会得到不同的输出 #!/usr/bin/env perl use warnings; use 5.012; use utf8; use open ':encoding(utf-8)'; use open ':std'; open my $fh, '>', 'test.txt' or die $!; say $fh 'käse'; close $fh; open my $fh1, '<', 'test.txt' or die $!; while ( m
#!/usr/bin/env perl
use warnings;
use 5.012;
use utf8;
use open ':encoding(utf-8)';
use open ':std';
open my $fh, '>', 'test.txt' or die $!;
say $fh 'käse';
close $fh;
open my $fh1, '<', 'test.txt' or die $!;
while ( my $row = readline( $fh1 ) ) {
print $row;
}
close $fh1;
use autodie;
open my $fh2, '<', 'test.txt';
while ( my $row = readline( $fh2 ) ) {
print $row;
}
close $fh2;
# Output:
# käse
# käse
#/usr/bin/env perl
使用警告;
使用5.012;
使用utf8;
使用开放式“:编码(utf-8)”;
使用open“:std”;
打开我的$fh、“>”、“test.txt”或die$!;
说$fh'käse';
收盘价$fh;
打开我的$fh1,“除非有人带着更好的理由进来,否则这看起来像是与open
pragma相关的autodie
错误
将最后一次打开更改为打开我的$fh2,'我刚刚为这个bug设计了一个补丁。