title: Using Ruby: Why is my array printing the results then an array of with idex numbers
body: <p>I have two methods:</p>
  
  <p><code>pwsplayerindex</code> finds a person that is in an array multiple times and gives the index of where their name is.</p>
  
  <p><code>statarray</code> uses the index # from <code>pwsplayerindex</code> to find other data in an array with hashes. </p>
  
  <pre><code>def pwsplayerindex(inplayer)
  arr = Array.new
  pwsarr.each_with_index do |val,index|
  if val['player'] == inplayer then arr &lt;&lt; index end
  end
      arr
  end
  
  def statarray(index,stat)
  indexarr = Array.new 
  pwsplayerindex((pwsarr[index]['player'])).each { |x| puts (pwsarr[x][stat])}   
  end  
  
   print statarray(0,'play')
  </code></pre>
  
  <p>Why does the result yield:</p>
  
  <pre><code>51.0
  29.9
  29.4
  28.1
  24.6
  16.6
  [0,82,88,113,192,472]
  </code></pre>
  
  <p>All I want it to give me is:</p>
  
  <pre><code>51.0
  29.9
  29.4
  28.1
  24.6
  16.6
  </code></pre>