Question: have a very simple one line console app (using monodevelop)

but getting below error.

`System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-e0902fb`

my app has reference two nuget package

* LibGit2Sharp 0.21.0.176
* LibGit2Sharp.NativeBinaries 1.0.119

`LibGit2Sharp.Repository.Init("foler path");`

[![enter image description here](https://i.stack.imgur.com/MyUsP.png)](https://i.stack.imgur.com/MyUsP.png)

[![enter image description here](https://i.stack.imgur.com/yHtZM.png)](https://i.stack.imgur.com/yHtZM.png)

Answer: 
`s = matches.to_a` is an array `["12+2"]`, the `eval(s.to_s)` will return the array `["12+2"]`, and when you print it, you will get the output `12+2`, a string representation of the array `["12+2"]`.

You should be `eval`ing the element of the array, in this case, `s[0]` or `s.first`.

Fix it like this:

```
perms=["12+2","22","-2+"]
perms.each do |line|
    matches=/^[\d]+[+-\/\*]{1}[\d]+$/.match(line)
    if matches
        s = matches.to_a
        puts eval(s.first)
    end
end

```

`matches` can be `nil` if there was no match. Use `eval` only if its not `nil` by checking `if matches`

---

You could further simplify the code and write something like this:

```
perms=["12+2","22","-2+"]
perms.each do |line|
    puts eval(line) if line =~ /^[\d]+[+-\/\*]{1}[\d]+$/
end

```
Instead of iterating through inputs, one might directly map them to outputs:

```
perms.map do |p|                      # map inputs to outputs
  eval(p) if p =~ /\A\d+[+-\/*]\d+\z/ # return eval’ed or nil
end.compact                           # get rid of nils

#⇒ [14]

```