# File lib/hiera/backend.rb, line 314
      def qualified_lookup(segments, hash, full_key = nil)
        value = hash
        segments.each do |segment|
          throw :no_such_key if value.nil?
          if segment =~ /^[0-9]+$/
            segment = segment.to_i
            unless value.instance_of?(Array)
              suffix = full_key.nil? ? '' : " from key '#{full_key}'"
              raise Exception,
                "Hiera type mismatch: Got #{value.class.name} when Array was expected to access value using '#{segment}'#{suffix}"
            end
            throw :no_such_key unless segment < value.size
          else
            unless value.respond_to?('[]''[]') && !(value.instance_of?(Array) || value.instance_of?(String))
              suffix = full_key.nil? ? '' : " from key '#{full_key}'"
              raise Exception,
                "Hiera type mismatch: Got #{value.class.name} when a hash-like object was expected to access value using '#{segment}'#{suffix}"
            end
            throw :no_such_key unless value.include?(segment)
          end
          value = value[segment]
        end
        value
      end