Re: length of an array in a struct in an array of structs in a struct in an array of structs



Tuan Bui wrote:
> I do know that
>
> scalar(@{@VisitArray[$i]->PSearchStructArray})
>
> will return the length of PSearchStructArray well enough though.

Perhaps I'm having a brain cramp here, but I can't especially see how
that could work. The arrow notation is used for either A)
dereferencing a hash or array reference to get at its elements or B)
calling a method of an object or class.

In other words, I can see that
$VisitArray[$i]->{PSearchStructArray}
might return the value of the hash referenced by $VisitArray[$i] at key
'PSearchStructArray', or
$VisitArray[$i]->PSearchStructArray()
might call a method of the object $VisitArray[$i], which could in turn
return a list of values.

I cannot, however, discern any way in which
$VisitArray[$i]->PSearchStructArray
could return "the length of PSearchStructArray".

Can you please enlighten me by showing the code that creates your
classes and objects?

(For why I replaced your '@' with '$' in each example, please see:
perldoc -q difference
)

Paul Lalli

.