The following code:
#!/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;
Yields:
Use of uninitialized value
$testin pattern match(m//)at test.pl line 9.
This seems to happen with any 2-byte character inside \x{}. The following regexes work fine:
/a+\x{2013}/
/.*\x{2013}/
/.+\x{20}/
Also, the error goes away with use bytes, but using that pragma is discouraged. What’s going on here?
It is singular that you should ask this question. I looks related to a bug that I just reported yesterday
https://rt.perl.org/rt3/Ticket/Display.html?id=114808where this code also produces
"Use of uninitialized value $_ in split ..."warnings, and causessplitto unexpectedly return an empty list: