diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-01-18 10:57:44 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-01-21 10:02:54 -0700 |
commit | 9ba22424c6f4c8c245fd5f3626f164f30c092c11 (patch) | |
tree | a23ce152da5f1b9058f3a7b27adab4c0cb34cc61 /pod/perluniintro.pod | |
parent | e05ffc7dc5f2f6ad3c06921fea74a047e7fd4c5f (diff) | |
download | perl-9ba22424c6f4c8c245fd5f3626f164f30c092c11.tar.gz |
perluniintro: Shorten too-long verbatim lines
Diffstat (limited to 'pod/perluniintro.pod')
-rw-r--r-- | pod/perluniintro.pod | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pod/perluniintro.pod b/pod/perluniintro.pod index 2ca2da2d8a..edd1ab48ce 100644 --- a/pod/perluniintro.pod +++ b/pod/perluniintro.pod @@ -303,7 +303,8 @@ will work on the Unicode characters (see L<perlunicode> and L<perlretut>). Note that Perl considers grapheme clusters to be separate characters, so for example - print length("\N{LATIN CAPITAL LETTER A}\N{COMBINING ACUTE ACCENT}"), "\n"; + print length("\N{LATIN CAPITAL LETTER A}\N{COMBINING ACUTE ACCENT}"), + "\n"; will print 2, not 1. The only exception is that regular expressions have C<\X> for matching an extended grapheme cluster. (Thus C<\X> in a @@ -474,7 +475,7 @@ displayed as C<\x..>, and the rest of the characters as themselves: join("", map { $_ > 255 ? # if wide character... sprintf("\\x{%04X}", $_) : # \x{...} - chr($_) =~ /[[:cntrl:]]/ ? # else if control character ... + chr($_) =~ /[[:cntrl:]]/ ? # else if control character... sprintf("\\x%02X", $_) : # \x.. quotemeta(chr($_)) # else quoted or as themselves } unpack("W*", $_[0])); # unpack Unicode characters @@ -690,7 +691,7 @@ and the C<length()> function: my $unicode = chr(0x100); print length($unicode), "\n"; # will print 1 require Encode; - print length(Encode::encode_utf8($unicode)), "\n"; # will print 2 + print length(Encode::encode_utf8($unicode)),"\n"; # will print 2 use bytes; print length($unicode), "\n"; # will also print 2 # (the 0xC4 0x80 of the UTF-8) |