From: Caleb Tennis Date: 2006-02-22T23:32:35+09:00 Subject: Re: How to evaluate file as Ruby code? >> For example, I have a file "foo" which contains the lines >> >> abc=4 >> def=5 >> >> I would like to "evaluate" the file such that after this, the >> variable abc is set to 4 and def is set to 5. > load will load and evaluate the file, it will reload and > re-evaluate. Keep in mind that using load keeps local variables local to their scope within the file: tc@tc8 ~ $ cat foo.txt a = 5 @b = 10 tc@tc8 ~ $ irb irb(main):001:0> load 'foo.txt' => true irb(main):002:0> @b => 10 irb(main):003:0> a NameError: undefined local variable or method `a' for #