title: Array of multiple text files from get-content
body: <p>As the title suggests I want to save the content of multiple text files into a 2 dimensional array.</p>
  
  <pre><code>$script[0] = Get-Content "test1.txt"
  $script[1] = Get-Content "test2.txt"
  </code></pre>
  
  <p>Which results in the error <code>Cannot index into a null array.</code>
  Apperantly this is due to the fact that the array isn't initialized.</p>
  
  <p>so I tried:</p>
  
  <pre><code>$script = @() 
  </code></pre>
  
  <p>and</p>
  
  <pre><code>for ($i = 0; $i -lt $scriptcount; $i++) 
  { 
    $script += @() 
  }
  </code></pre>
  
  <p>and eventually</p>
  
  <pre><code>for ($i = 0; $i -lt $scriptcount; $i++) 
  { 
    $script += @(@()) 
  }
  </code></pre>
  
  <p>but all of above ended up with the error <code>Index was outside the bounds of the array.</code></p>
  
  <p>So what can I do to save these files into my 2d array?</p>
  
  <p><em>A small side question</em> : with these 2d arrays is it possible to generate the count of arrays?</p>
  
  <p>because <code>$script.Count</code> ends up with the length of the first sentence instead of the amount of arrays.</p>