Nobuyoshi Nakada wrote:
> Hi,
> 
> At Sat, 14 Feb 2009 15:09:46 +0900,
> 7stud -- wrote in [ruby-talk:328177]:
>> That doesn't work for me:
>> 
>> r1test.rb
>> --------
>> puts "hello"
>> puts x
> 
> require separates the scope, so local variables defined outside
> are not accessible.
> 

1) require?  Where, what, when?

> $ ruby -e 'x=10; eval(File.read($0 = ARGV.shift), binding)' r1test.rb
> hello
> 10

2) Isn't specifying 'binding' redundant unless you acquire a binding 
from a different scope?

3) Why the $0 = ARGV.shift ?  This appears to work the same way:

$ ruby -e 'x=10; eval(File.read(ARGV[0]) )' r1test.rb


-- 
Posted via http://www.ruby-forum.com/.