charnames
use charnamesHOW; print "\N{CHARNAME} is a funny character"; use charnames (); # no compile–time \N{}, just run–time functions
All forms other than use charnames
() enable interpolation of named characters into strings and
regexes using the \N{CHARNAME} notation:
use charnames ":full";
print "\N{GREEK SMALL LETTER SIGMA} is called sigma.\n";
use charnames ":short";
print "\N{greek:Sigma} is an uppercase sigma.\n";
use charnames qw(cyrillic greek);
print "\N{sigma} is Greek sigma, and \N{be} is Cyrillic b.\n";
use charnames ":full", ":alias" => {
"WRY CAT" => "CAT FACE WITH WRY SMILE",
"AMELIA" => "DROMEDARY CAMEL",
"s with comma" => 0x0219,
};
# ":loose" supported on v5.16 and later only
use charnames ":loose";If :full is present, then
\N{
is expanded by looking first in the list of standard Unicode character
names. If CHARNAME}:short is present, and
CHARNAME has the form
SCRIPT:CNAME, then
CNAME is looked up as a letter in script
SCRIPT. If :loose is present (and you are running v5.16 or
better), it works just like :full
except names are looked up without regard to case, whitespace, or
underscores, just as in Unicode property names in regexes.
Used with one or more Unicode script name arguments,[260] CHARNAME is looked up as a letter
in the given scripts, first looking in the first listed script, then the
next one if any, and so on. For lookup of
CHARNAME inside a given script
SCRIPTNAME, it looks for the names:
SCRIPTNAMECAPITAL LETTERCHARNAMESCRIPTNAMESMALL LETTER ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access