title: Why does this eval not work in Ruby
body: <p>Can you explain this?</p>
  
  <p>I want to eval values and calculations from two different sources. One source gives me the following info(programmatically):</p>
  
  <pre><code>'a = 2'
  </code></pre>
  
  <p>The second source gives me this expression to evaluate:</p>
  
  <pre><code>'a + 3'
  </code></pre>
  
  <p>This works:</p>
  
  <pre><code>a = 2
  eval 'a + 3'
  </code></pre>
  
  <p>This also works:</p>
  
  <pre><code>eval 'a = 2; a + 3'
  </code></pre>
  
  <p>But what I really need is this, and it doesn't work:</p>
  
  <pre><code>eval 'a = 2'
  eval 'a + 3'
  </code></pre>
  
  <p>I would like to understand the difference, and how can I make the last option work.</p>
  
  <p>Thanks for your help.</p>