the unnecessary "use bytes" ones.
TODO: scour the documentation for unnecessary "use utf8"
and prominently display it in perldelta when the time comes.
("use utf8" should be necessary ONLY if one wants the script
to be in UTF-8.) Also should be checked in some non-ASCII
non-Latin-1 platform, like EBCDIC.
p4raw-id: //depot/perl@11638
print "ok ",$i++,"\n";
{
- use utf8;
print "not " unless v5.5.640 eq "\x{5}\x{5}\x{280}";
print "ok ",$i++,"\n";
}
}
-no utf8; # so that the naked 8-bit chars won't gripe under use utf8
+no utf8; # needed for use utf8 not griping about the raw octets
$| = 1;
my $total_tests = 25;
$_ = $dx = "\x{10f2}";
s/($dx)/$dx$1/;
{
- use bytes;
print "not " unless $_ eq "$dx$dx";
print "ok $test\n";
$test++;
$_ = $dx = "\x{10f2}";
s/($dx)/$1$dx/;
{
- use bytes;
print "not " unless $_ eq "$dx$dx";
print "ok $test\n";
$test++;
$_ = "\x{10f2}\x{10f2}";
s/($dx)($dx)/$1$2/;
{
- use bytes;
print "not " unless $_ eq "$dx$dx";
print "ok $test\n";
$test++;
print "ok 21\n";
print "not " if exists $u{$a};
print "ok 22\n";
-print "#$b{$_}\n" for keys %b; # Used to core dump before change #8056.
+print "# $b{$_}\n" for keys %b; # Used to core dump before change #8056.
print "ok 23\n";
-print "#$u{$_}\n" for keys %u; # Used to core dump before change #8056.
+print "# $u{$_}\n" for keys %u; # Used to core dump before change #8056.
print "ok 24\n";
-use bytes ();
-
# on EBCDIC chars are mapped differently so pick something that needs encoding
# there too.
$d = pack("U*", 0xe3, 0x81, 0xAF);
-$ol = bytes::length($d);
+{ use bytes; $ol = bytes::length($d) }
print "not " unless $ol > 3;
print "ok 25\n";
%u = ($d => "downgrade");
for (keys %u) {
- use bytes;
print "not " if length ne 3 or $_ ne "\xe3\x81\xAF";
print "ok 26\n";
}
{
- use bytes;
- print "not " if length($d) != $ol;
+ { use bytes; print "not " if bytes::length($d) != $ol }
print "ok 27\n";
}
"#latin[$latin]\nnot ok $test\n";
$test++;
$latin =~ s/stra\337e/straße/; # \303\237 after the 2nd a
- use utf8;
+ use utf8; # needed for the raw UTF-8
$latin =~ s!(s)tr(?:aß|s+e)!$1tr.!; # \303\237 after the a
}
}
'/\p{x/' => 'Missing right brace on \p{} in regex; marked by {#} in m/\p{{#}x/',
- 'use utf8; /[\p{x]/' => 'Missing right brace on \p{} in regex; marked by {#} in m/[\p{{#}x]/',
+ '/[\p{x]/' => 'Missing right brace on \p{} in regex; marked by {#} in m/[\p{{#}x]/',
'/(x)\2/' => 'Reference to nonexistent group in regex; marked by {#} in m/(x)\2{#}/',
'/\x{1/' => 'Missing right brace on \x{} in regex; marked by {#} in m/\x{{#}1/',
- 'use utf8; /[\x{X]/' => 'Missing right brace on \x{} in regex; marked by {#} in m/[\x{{#}X]/',
+ '/[\x{X]/' => 'Missing right brace on \x{} in regex; marked by {#} in m/[\x{{#}X]/',
'/[[:barf:]]/' => 'POSIX class [:barf:] unknown in regex; marked by {#} in m/[[:barf:]{#}]/',
# doubles (if supported), of machine-specific short and long
# integers, machine-specific floating point exceptions (infinity,
# not-a-number ...), of the effects of locale, and of features
-# specific to multi-byte characters (under use utf8 and such).
+# specific to multi-byte characters (under the utf8 pragma and such).
BEGIN {
chdir 't' if -d 't';
print "ok 10\n";
{
-if (ord("\t") == 9) { # ASCII
- use utf8;
-}
# 11 - changing UTF8 characters in a UTF8 string, same length.
my $l = chr(300); my $r = chr(400);
$x = 200.300.400;