EDIT: Sorry I forgot to add the output.
julia> n=5
5
julia> for i in ["foo","bar"]
x_$i=zeros(n,n)
println("x_$i")
end
x_foo
x_bar
julia> x_foo
ERROR: x_foo not defined
As John said, a dict would be far better.
If you feel the need to access the bounding names through a template like this, then you'd better build a dict from the start or just before using your trick.
If your elements are well known, you could even directly use an array : if you need both the content and the name, you can 'zip' them or 'enumerate' them.
On the fly bounding name generation (even just reading its content) is considered a bad practice because these names should only be relevant to the programmer, not to the program : you are really trying to achieve a functional equivalent to a dict.