Just a note about your structure - Your methods and attributes above are defined to be arrays with only one element. That's certainly an unnecessary complication. I'm wondering if someone went to all the bother of creating such a complex structure if they didn't also define accessor methods for you to use.
my @descriptions = () for my $class (@{VAR1{classes}}) { my %local_hash = (); $local_hash{id} = $class->{classid}; $local_hash{description} = $class->{classdescription}; push @descriptions, {%local_hash}; for my $method (@{$class->{methods}}) { my %local_hash = (); $local_hash{id} = $method->{methodid}; $local_hash{description} = $method->{methoddescription}; push @descriptions, {%local_hash}; } for my $attribute (@{$class->{attributes}}) { my %local_hash = (); $local_hash{id} = $attribute->{attributeid}; $local_hash{description} = $attribute->{attributedescription}; push @descriptions, {%local_hash}; } }
Update:Fixed typos.
In reply to Re: Retrieving data from deep structure
by kennethk
in thread Retrieving data from deep structure
by enikao
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |