Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl autodie杂注对编码有影响吗?_Perl_Encoding_Autodie - Fatal编程技术网

Perl 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

为什么在“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 ( 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设计了一个补丁。