# Parse vector from string

**URL:** https://discourse.julialang.org/t/parse-vector-from-string/10728
**Category:** General Usage
**Tags:** strings, sparse
**Created:** [May 5, 2018, 4:14pm UTC](https://discourse.julialang.org/t/parse-vector-from-string/10728 "2018-05-05T16:14:02Z")
**Posts on this page:** 1
**Showing post:** 16

<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 7, 2022, 2:45pm UTC](https://discourse.julialang.org/t/parse-vector-from-string/10728/16 "2022-03-07T14:45:44Z")

</div>

The bigger problem than `Meta.parse` is `eval`:

> [@mbauman](#):
>
> It doesn’t work the way you expect within functions

Julia’s `eval` only works at global scope. If you do something like `eval(parse("y = [1,2,3]"))`, it’ll create a global `y` that’s separate from any local `y`s you might have inside your function. At best, it’ll be very slow and fragile.

> [@mbauman](#):
>
> it is prone to security issues

Especially if you’re parsing user input.

```julia
julia> eval(Meta.parse("[1,2,3,run(`echo 'rm -rf /'`)]"));
rm -rf /

```

Oops.

---

_[View the full topic](https://discourse.julialang.org/t/parse-vector-from-string/10728)._
