"Robert Klemme" <bob.news / gmx.net> wrote in message > try this > > $>ruby -e 'str = "a = 2"; eval(str, binding); puts a' C:\>ruby -ve 'str = "a=2"; eval(str,binding); puts a' ruby 1.8.0 (2003-05-26) [i386-mswin32] -e:1: undefined local variable or method `a' for main:Object (NameError) C:\>ruby -ve 'str = "a=2"; eval(str,TOPLEVEL_BINDING); puts a' ruby 1.8.0 (2003-05-26) [i386-mswin32] -e:1: undefined local variable or method `a' for main:Object (NameError) > You need to give the current context for locals, otherwise eval creates > its own scope. Simply doing that did not work. There _must_ be some way ... how else could irb make it work ?