10 print "not " unless length("") == 0;
13 print "not " unless length("abc") == 3;
17 print "not " unless length() == 6;
20 # Okay, so that wasn't very challenging. Let's go Unicode.
25 print "not " unless length($a) == 1;
30 print "not " unless $a eq "\x41" && length($a) == 1;
36 my $a = pack("U", 0x80);
38 print "not " unless length($a) == 1;
45 printf "#%vx for 0x80\n",$a;
46 print "not " unless $a eq "\x8a\x67" && length($a) == 2;
50 print "not " unless $a eq "\xc2\x80" && length($a) == 2;
59 print "not " unless length($a) == 1;
66 printf "#%vx for 0x100\n",$a;
67 print "not " unless $a eq "\x8c\x41" && length($a) == 2;
71 print "not " unless $a eq "\xc4\x80" && length($a) == 2;
78 my $a = "\x{100}\x{80}";
80 print "not " unless length($a) == 2;
87 printf "#%vx for 0x100 0x80\n",$a;
88 print "not " unless $a eq "\x8c\x41\x8a\x67" && length($a) == 4;
92 print "not " unless $a eq "\xc4\x80\xc2\x80" && length($a) == 4;
99 my $a = "\x{80}\x{100}";
101 print "not " unless length($a) == 2;
108 printf "#%vx for 0x80 0x100\n",$a;
109 print "not " unless $a eq "\x8a\x67\x8c\x41" && length($a) == 4;
113 print "not " unless $a eq "\xc2\x80\xc4\x80" && length($a) == 4;
119 # Now for Unicode with magical vtbls
124 tie $a, 'Tie::StdScalar'; # makes $a magical
127 print "not " unless length($a) == 1;
132 print "not " unless length($a) == 3;