如何获取已知 Unicode 字符名称的列表

Ale*_*eev 4 unicode perl

如何获取可以"\N{...}"从 perl 中使用的所有已知名称的列表?无法弄清楚与Unicode::UCD或其他核心模块有关。

Sha*_*awn 8

Unicode::UCD 和一个循环:

#!/usr/bin/env perl
use strict;
use warnings;
use Unicode::UCD qw/charinfo/;
use feature qw/say/;

say "Character names defined by Unicode ", Unicode::UCD::UnicodeVersion();
for (my $cp = 0; $cp <= 0x10FFFF; $cp += 1) {
    my $info = charinfo($cp);
    say $info->{"name"} if defined $info && $info->{"name"} ne "";
}
Run Code Online (Sandbox Code Playgroud)