Perl Unicode Cookbook: Get Character Number by Name

℞ 7: Get character number by name

Unicode allows you to refer to characters by number or by name. Computers don’t care, but humans do. When you have a character name, you can translate it to its number with the charnames pragma:

 use charnames ();
my $number = charnames::vianame("GREEK CAPITAL LETTER SIGMA");

This is, of course, the opposite of Get Character Names by Number.

See Characters and Their Numbers to translate from this number to the appropriate character.

Previous: ℞ 6: Get Character Names by Number

Series Index: The Standard Preamble

Next: ℞ 8: Unicode Named Characters

Tags

Feedback

Something wrong with this article? Help us out by opening an issue or pull request on GitHub