Why does this not work (bar->undefined) and what's a better way to do it?:

require 'erb'

FOO = 'Hello <%= bar %>'
class Foo
  def doit
    bar = 'World!'
    puts ERB.new(FOO).result
  end
end

Foo.new.doit

I need to use $bar instead of bar to get it going...

-- 
Wybo