diff options
author | Karl Williamson <public@khwilliamson.com> | 2011-12-18 20:45:14 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2011-12-20 22:02:42 -0700 |
commit | fbb93542d6662666a88828fb4c15803f8ba377f0 (patch) | |
tree | 300d9b114ad07a3281c6575d2abb02b7645389b7 /pod/perluniintro.pod | |
parent | f8988b416c244747b17eb3004ac6f8bbcf366e7a (diff) | |
download | perl-fbb93542d6662666a88828fb4c15803f8ba377f0.tar.gz |
Autoload charnames for \N{name}
This autoloads charnames.pm when needed. It uses the :full and :short
options. :loose is not used because of its relative unfamiliarity in
the Perl community, and is slower. (If someone later added a typical
"use charnames qw(:full)", things that previously matched under :loose
would start to fail, causing confustion. If :loose does become more
common, we can change this in the future to use it; the converse isn't
true.)
The callable functions in the module are not automatically loaded. To
access them, an explicity "use charnames" must be provided.
Thanks to Tony Cook for doing a code inspection and finding a missing
SPAGAIN.
Diffstat (limited to 'pod/perluniintro.pod')
-rw-r--r-- | pod/perluniintro.pod | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/pod/perluniintro.pod b/pod/perluniintro.pod index 778c5de5be..2ca2da2d8a 100644 --- a/pod/perluniintro.pod +++ b/pod/perluniintro.pod @@ -270,10 +270,9 @@ always produced. If you want to force the production of Unicode characters regardless of the numeric value, use C<pack("U", ...)> instead of C<\x..>, C<\x{...}>, or C<chr()>. -You can also use the C<charnames> pragma to invoke characters +You can invoke characters by name in double-quoted strings: - use charnames ':full'; my $arabic_alef = "\N{ARABIC LETTER ALEF}"; And, as mentioned above, you can also C<pack()> numbers into Unicode @@ -304,7 +303,6 @@ 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 - use charnames ':full'; print length("\N{LATIN CAPITAL LETTER A}\N{COMBINING ACUTE ACCENT}"), "\n"; will print 2, not 1. The only exception is that regular expressions |