Am I missing something with eval? Why does this code not work?

eval("foo = 1")
puts foo

Gives:

C:\example\trunk>ruby script/runner lib/aggregate/keith.rb
C:/example/trunk/vendor/rails/railties/lib/commands/runner.rb:45:
undefined local variable or method `foo' for main:Obje
ct (NameError)
        from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `eval'
        from
C:/noozler/trunk/vendor/rails/railties/lib/commands/runner.rb:45
        from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
        from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
        from script/runner:3
-- 
Posted via http://www.ruby-forum.com/.