From: yermej Date: 2008-01-24T07:59:57+09:00 Subject: Re: Help with eval On Jan 23, 4:13 pm, Keith Carter wrote: > Hm. You're right, that did work. How come the second bit below doesn't > work? > > Loading development environment (Rails 2.0.2)>> eval("foo = 1") > => 1 > >> foo > => 1 > >> begin > ?> eval("bar=1") > >> bar > >> end > > NameError: undefined local variable or method `bar' for > # > from (irb):5 For even more fun, evaluate bar once you've gotten the NameError. >> bar => 1 Sorry, but I don't know why, only that it seems odd.