我已经编写了一个代码来访问 perl 中的嵌套数据(非常复杂)数据结构。
<%method searchFeatureInFG>
<%args>
$featureGroup
$featureNameHash
</%args>
<%init>
my $foundFeature = 0;
my $foundGroup = undef;
my $foundIndex = undef;
if(defined $featureGroup && defined $featureNameHash){
for(my $i = 0; $i < @$featureGroup; $i++){
#print "<pre>".Data::Dumper::Dumper($featureGroup->[$i]->{'features'})."</pre>";
if(ref($featureGroup->[$i]) eq 'HASH'){
if(defined $featureNameHash->{$featureGroup->[$i]->{'name'}}){
$foundGroup = $featureGroup;
$foundIndex = $i;
$foundFeature = 1;
}
elsif(defined $featureGroup->[$i]->{'features'}){
for(my $j = 0; $j<scalar @{$featureGroup->[$i]->{'features'}} ; $j++){
for(my $k=0;$k<scalar @{$featureGroup->[$i]->{'features'}->[$j]->{'features'}};$k++) {
if (defined $featureGroup->[$i]->{'features'}->[$j]->{'features'}->[$k]->{'name'}) {
print $featureGroup->[$i]->{'features'}->[$j]->{'features'}->[$k]->{'name'}."\n";
}
}
last if !defined $featureGroup->[$i+1]->{'features'};
}
}
}
}elsif(defined $featureNameHash->{$featureGroup->[$i]}){
$foundFeature = 1;
$foundGroup = $featureGroup;
$foundIndex = $i;
}
last if($foundFeature);
}
}
return ($foundFeature, $foundGroup, $foundIndex);
</%init>
</%method>
这给了我如下错误。
Global symbol "$i" requires explicit package name at
Global symbol "$foundFeature" requires explicit package name at
Global symbol "$foundGroup" requires explicit package name at
Global symbol "$featureGroup" requires explicit package name at
Global symbol "$foundIndex" requires explicit package name at
这些错误是什么意思?