$cost = $h->{$location}{$building}; #### $cost = $h->{"Locations.$location.Buildings.$b.cost"};