in reply to Retrieving data from deep structure
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Retrieving data from deep structure
by enikao (Initiate) on Dec 05, 2008 at 23:54 UTC | |
by JadeNB (Chaplain) on Dec 06, 2008 at 00:02 UTC | |
by enikao (Initiate) on Dec 06, 2008 at 00:19 UTC |