Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to analyze this hash of hash example?

Tags:

perl

For the following code snippet, is my understanding of $label = $classifier->{result}->{forcast}->[$i]->{label}; correct?

1) result is used as the key for hash ref of classifier;

2) forcast is used as the key for hash ref of $classifier->{result}

3) $classifier->{result}->{forcast} is a ref to an array, and i-th value of this array is also a hash reference

4) The label is the key of the hash reference $classifier->{result}->{forcast}->[$i]. The corresponding value is assigned to the left side of $label.

my $i=0;
while (<classifierinput>)
{
   $label = $classifier->{result}->{forcast}->[$i]->{label};
   $i++;
}
like image 348
bit-question Avatar asked Nov 04 '22 08:11

bit-question


1 Answers

Yes, your understanding is correct.

like image 145
tadmc Avatar answered Nov 09 '22 09:11

tadmc