--f46d04447f113b118d04b2bc5121 Content-Type: text/plain; charset=ISO-8859-1 On Sun, Nov 27, 2011 at 1:17 PM, hari mahesh <harismahesh / gmail.com> wrote: > Can we call an array from one ruby script to another and access array > elements.? > > for example : my first rb file > > 1.rb > $joe one" > $po two" > $so three" > names $joe, $po, $so ] > second rb file > > 2.rb > require "1" > $trial ames[1] > puts $trial > But this didnt worked. Any help plz. > > -- > Posted via http://www.ruby-forum.com/. > > Variables that begin with dollar signs are global. So if you namei t $names, then it will be available everywhere. You could also define a function that returns the array. Toplevel functions are defined privately on Object, which nearly all objects inherit from, making it essentially globally visible: def names ['one', 'two', 'three'] end Depending on what you're trying to do, there are a number of possible ways to handle this. --f46d04447f113b118d04b2bc5121--