This is declaring var_name global, not whatever symbol stored in var_name to be global. You must use eval to create global variables from a runtime value but you also shouldn’t do that. What are you tryingn to accomplish?
On a side note, use Symbol("p$i") instead if you really want to generate variable names.
julia> p = rand(3)
julia> for i in 1:length(p)
println("p[$i] = ", p[i])
end
p[1] = 0.4687558912523784
p[2] = 0.6334251270809983
p[3] = 0.2641717376126682