次のコード:
#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
use 5.012; # implicitly turn on feature unicode_strings
my $test = "some string";
$test =~ m/.+\x{2013}/x;
収量:
test.pl 9 行
$test
目のパターンマッチで初期化されていない値が使用されています。(m//)
これは、 内の任意の 2 バイト文字で発生するよう\x{}
です。次の正規表現は正常に機能します。
/a+\x{2013}/
/.*\x{2013}/
/.+\x{20}/
また、エラーは で解消されますがuse bytes
、そのプラグマの使用はお勧めできません。何が起きてる?