# thread::shared only allws a single level of shared structure
# needs a explicit hash creation for nested data structures
my %counts : shared = ();
foreach my $state (%known_states) {
# COUNTS
unless (exists $counts{build}) {
my %cb : shared;
$counts{build} = \%cb;
}
$counts{build}{$state} = 0;
}
现在,我必须像上面那样做,对于每个子级哈希表,我必须明确地创建一个哈希引用。
有更好的方法吗?
附言:如果我不创建哈希引用,则会因为尝试将其用作哈希表而出现“无效的共享标量值”错误。