我有以下Perl脚本,旨在显示丹麦语的排序规则。
#!/usr/local/ActivePerl-5.16/bin/perl
use 5.014_001;
use utf8;
use Unicode::Collate;
use strict;
use warnings;
use Carp;
use Data::Dump;
use Encode qw( encode_utf8 );
use Unicode::Collate::Locale;
binmode STDOUT, ':encoding(UTF-8)';
my @words =("AAI Document Type", "Apple", "Zebra");
my $coll = Unicode::Collate::Locale->new(locale => "da");
my @result = $coll->sort(@words);
foreach my $item (@result){
print $item, "\n";
}
输出
Apple
Zebra
AAI Document Type
为什么“AAI文件类型”走到了尽头?似乎有一些关于“AA”的东西会触发这种行为。
答案 0 :(得分:4)