sub cost { my ($self, $location, $b) = @_; $self->{Locations}{$location}{Buildings}{$b}{cost}; } # . . . my $cost = $h->cost($location, $b)