From: Kristof Bastiaensen Date: 2004-04-22T01:19:06+09:00 Subject: Re: Ruby proposal: MAIN_BINDING > If "a" is previously defined as a variable, the compiler causes the > "puts a" command to simply output its value; but if "a" is not > previously defined, my understanding is that "puts a" interprets "a" as > a method call. In this case, "eval" statement (whose command is not, of > course, touched by the interpreter) indeed sets the "a" variable in the > global scope, but the "print" statement doesn't access it. I think you meant "local scope"? > > I'm don't know if there's a syntactical way around this. There are ways, but they aren't beautiful. for example: eval("a = 4") puts a = a => 4 By the asignment ruby will treat a as a local variable and give the right result.