From: Alex Stahl Date: 2010-10-15T06:53:04+09:00 Subject: Re: Kind of nested loops Er, why would you want to store an array of hashes like that, instead of just a hash? It would make iterating much easier to use a hash like so: log = { 'where' => '/path/to/fileA', 'when' => '/path/to/fileB', 'bank' => '/path/to/fileN' } #repeat w/ 'top' build = [log, top] Then, "build[0]['where'] = '/path/to/fileA'". Note that, in your implementation, the first array only contains the strings "log " and "top", and not the hashes, so my last line would evaluate to nil, not the path. On Thu, 2010-10-14 at 16:30 -0500, Veedo Dream wrote: > I am trying to get this going where i have this build array and then I > have an array of hashes named after the items in the build. Depending > upon what is in the array, I want to read the arrays of hashes. I wrote > this simple script, but does not work. Any solns > build = [ "log " , > "top" ] > > > log = [ > > { 'where' => '/home/des/blocks/where.rb'}, > { 'when' => '/home/des/blocks/when.rb'}, > { 'bank' => '/home/des/blocks/bank.rb'} > ] > top = [ > > { 'where' => '/home/top/blocks/where.rb'}, > { 'when' => '/home/top/blocks/when.rb'}, > { 'bank' => '/home/top/blocks/bank.rb'} > ] > > > build.each{ |bu| > puts bu > bu.each{ |files| > puts files > > }} >