in reply to Dotted hash access
The advantage of perl's notation is that it is consistent and, with practice, it tells you everything about the structure above the data.
The usual way to make that briefer would be to make a real data accessor,
where the cost method is defined in the namespace of the $h object.sub cost { my ($self, $location, $b) = @_; $self->{Locations}{$location}{Buildings}{$b}{cost}; } # . . . my $cost = $h->cost($location, $b)
It probably would help to break the big data structure into subobjects to which the whole has a 'has-a' relation.
I agree that big deep data structures full of bits of everything are awkward to handle. I don't think notation is the real problem. It's a design matter.
After Compline,
Zaxo
|
|---|