camenix wrote: > Hello all, > I have two file : > > config.rb: > tool_mysql='X:/mysql.exe' > > main.rb : > require "config.rb" > puts tool_mysql > > It didn't work.for main.rb can not import variable from config.rb > > Is there any mothod to do this without parsing config.rb? Using $globals or CONSTANTS is fine for simple programs, but these pollute the global namespace. If you really want to use ruby syntax in config.rb (rather than YAML or other text formats), there are some alternatives: http://raa.ruby-lang.org/project/script/ http://codeforpeople.com/lib/ruby/dynaload/ The first one (that's the one I wrote) doesn't let you grab local variables from config.rb, but it does let you access constants (including classes and modules) and methods defined in config.rb. The constants and methods are wrapped up in a new module and you access them through this module. This prevents namespace pollution. There's a simple example at: /home/vjoel/ruby/prj/script/doc/index.html and some more examples in the package's example/ dir. You might also find these projects interesting: http://raa.ruby-lang.org/project/amarshal/ http://rubyforge.org/projects/ron HTH. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407