如何获得没有的数量.perl 6%HASH中的按键?

Use*_*d82 3 hash count perl6

任何人都可以帮助知道如何计算不.在PERL 6中,哈希中的键是什么?寻找没有手动循环的东西.

提前致谢!

编辑:到目前为止尝试了以下但没有运气.

my %hash =  1 => "one", 2 => <21,22,23>, 3 => "three"  ;

my $count = %hash.keys [ makes it a flat list ]
my $count = %hash.count [no such method]
my $count = keys %hash [provides all the keys but not the count]
Run Code Online (Sandbox Code Playgroud)

Syl*_*ter 10

在perl5中,你可以将哈希值转换为标量,它就成了计数.你也可以在perl6中做到这一点:

%hash.Int;  
# => 3
+%hash
# => 3
Run Code Online (Sandbox Code Playgroud)

你也有elems方法:

%hash.elems;  
# => 3
Run Code Online (Sandbox Code Playgroud)