From: 7stud -- Date: 2009-02-14T16:52:12+09:00 Subject: Re: how to require more than one thing from the command line 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/.