Re: How to get scalar context of a list within a complex array

[email protected] ("Jeff Peng")
Newsgroups perl.beginners
Message-ID <[email protected]>
On Thu, Jun 12, 2008 at 9:37 PM, Christopher Morgan <[email protected]> wrote:

> This list can vary in size from element to element, so I would like a way to
> refer to the list in scalar context to get its size. How do I do that?
>

Hi,

since $fields[0]->{'_subfields'} is an anonymous array,
you can derefer it by saying,

@{ $fields[0]->{'_subfields'} };

So,

scalar @{ $fields[0]->{'_subfields'} };

will get its length.

-- 
Jeff Peng - [email protected]
Professional Squid supports in China
http://www.ChinaSquid.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.