# Problem with string interpolation (needs parens)

**URL:** <https://discourse.julialang.org/t/problem-with-string-interpolation-needs-parens/2841>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 23, 2017, 6:13pm UTC](https://discourse.julialang.org/t/problem-with-string-interpolation-needs-parens/2841 "2017-03-23T18:13:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)\
**Post date:** [March 23, 2017, 6:13pm UTC](https://discourse.julialang.org/t/problem-with-string-interpolation-needs-parens/2841/1 "2017-03-23T18:13:57Z")

</div>

What wrong below ?

```julia
julia> eval(parse("$i = readcsv(\"dane_waluty/chfxau_d.csv.txt\")"))
7023×5 Array{Any,2}:
 "Date" "Open" "High" "Low" "Close"
 "1984-01-09" 12.15 12.15 12.15 12.15
 "1984-01-16" 11.984 11.984 11.984 11.984
 "1984-01-23" 12.249 12.249 12.249 12.249
 "1984-01-30" 11.859 11.859 11.859 11.859
...
 "2017-03-20" 8.14568 8.15433 8.10901 8.11148
 "2017-03-21" 8.10896 8.17156 8.07113 8.08309
 "2017-03-22" 8.08116 8.10821 8.06253 8.07729

julia> i
"chf"

julia> eval(parse("$i = readcsv(\"dane_waluty/$ixau_d.csv.txt\")"))
ERROR: UndefVarError: ixau_d not defined

```

Paul

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [March 23, 2017, 6:19pm UTC](https://discourse.julialang.org/t/problem-with-string-interpolation-needs-parens/2841/2 "2017-03-23T18:19:33Z")

</div>

As the error message says, you are using `ixau_d` (in the string interpolation) but it’s not defined.

Also note that you shouldn’t be calling `eval(parse(...))` in any case.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [March 23, 2017, 6:24pm UTC](https://discourse.julialang.org/t/problem-with-string-interpolation-needs-parens/2841/3 "2017-03-23T18:24:25Z")

</div>

> [@programista](#):
>
> $ixau\_d

More specifically, use `$(i)xau_d`. Without the parentheses, Julia just sees one token: `ixau_d`. Note that using eval like this is generally not a good solution — it’s confusing, easy to break, and often won’t do what you might expect it to when you move from the REPL to a function.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [March 24, 2017, 4:37pm UTC](https://discourse.julialang.org/t/problem-with-string-interpolation-needs-parens/2841/4 "2017-03-24T16:37:43Z")

</div>

… The issue is too obvious from the syntax highlighting so I didn’t realize that’s what the code is meant to do.
