in reply to Using multi-level hashes
can be written $project{$activeProject}{components}{Software}{subComponents}{Database}{label}$project{$activeProject}->{components}->{"Software"}->{subComponents}- >{"Database"}->{label}
You were on track for adding elements to the hash without typing the entire structure each time. To add stuff to that final level, you can do:
$subDatabase->{label} = "whatever"; $subDatabase->{foobar} = "something else";
Since $subDatabase is a reference to the original structure, the changes will persist after you leave the sub (assuming %project is defined outside the sub's scope, as it appears.)
Note: It's always a good idea, but especially when working with complex data structures, to turn strict and warnings on, if you haven't already.
|
|---|