title: Taking a string, reversing the letter in each word while leaving the word in its original position
body: <p>I am trying to take a sentence, and reverse the positions of the letters in each word.</p>
  
  <p>Below is my code that does not work:</p>
  
  <pre><code>def test(sentence)
   array = []
   array &lt;&lt; sentence.split
   array.collect {|word| word.reverse}
  end
  </code></pre>
  
  <p>My problem is with:</p>
  
  <pre><code>array &lt;&lt; sentence.split
  </code></pre>
  
  <p>It says it divides each word, but when I use interpolation, it reverses the whole sentence. Below is a similar code that works:</p>
  
  <pre><code>def test2
   dog = ["Scout", "kipper"]
   dog.collect {|name| name.reverse}
  end
  </code></pre>
  
  <p>But it does not accept a sentence, and it already has the array defined.</p>