From: Brian Candler Date: 2011-03-07T06:43:37+09:00 Subject: Re: ruby script Mlle wrote in post #985808: > I wrote a ruby script but I'd like to define a method within it and > call the method from the main method. How do I do that? Do I have to > define the whole file as a module or something? Nope (although using modules can make your code easier to reuse and/or combine with other code) Simple example which I think achieves what you want: ---- a.rb ---- def say_hello puts "Hello, world!" end ---- b.rb ---- require 'a' say_hello ---- command line ---- ruby b.rb -- Posted via http://www.ruby-forum.com/.