title: Iterating over a multidimensional array?
body: <pre><code>class Lod
  
  attr_accessor :lodnr
  attr_accessor :lobnr
  attr_accessor :stknr
  
  def initialize(lodnr, lobnr, stknr)
      @lodnr = lodnr
      @lobnr = lobnr
      @stknr = stknr.chomp
  end
  
  def to_s
      "%8s, %5s, %3s" % [@lodnr, @lobnr, @stknr]
  end
  end
  </code></pre>
  
  <p>I have an array called <code>sold</code> which contains these four arrays:</p>
  
  <pre><code>[10000, 150, 5]
  [500, 10, 1]
  [8000, 171, 3]
  [45, 92, 4]
  </code></pre>
  
  <p>The four arrays are objects of a class, imported from at .txt file. </p>
  
  <pre><code>    input = File.open("lodsedler.txt", "r")
  input.each do |line|
      l = line.split(',')
      if l[0].to_i.between?(0, 99999) &amp;&amp; l[1].to_i.between?(1, 180) &amp;&amp; l[2].to_i.between?(1, 10)
          sold &lt;&lt; Lod.new(l[0], l[1], l[2])
      else
          next
      end
  end
  </code></pre>
  
  <p>I want to count the first value in each array, looking for a randomly selected number which is stored in <code>first</code>.</p>
  
  <p>The error I get is always something like this, whatever i try:</p>
  
  <pre><code>Undefined method xxx for #Lod:0x0000000022e2d48&gt; (NoMethodError)
  </code></pre>
  
  <p>The problem is that i can't seem to acces the first value in all the arrays. </p>