title: Creating dynamic variable array names and then adding object to them
body: <p>What I'm trying to do is create array variable names dynamically, and then with a loop, add the object to its relevant array based on the hash table value being equal to the counter variable.</p>
  
  <pre><code>$hshSite = @{}  # Values like this  CO,1  NE,2  IA,3
  
  $counter = $hshSite.count
  
  For($i = $counter; $i -gt 0; $i--) {
  New-Variable -Name "arr$i" -Value @()
  }
  </code></pre>
  
  <p>If $counter = 3, I would create arrays $arr1, $arr2, $arr3</p>
  
  <pre><code>$csv = Import-CSV....
  
  ForEach ($x in $csv) {
     #if $hshSite.Name = $x.location (ie CO), look up hash value (1),
     and add the object to $arr1.  If $hshSite.Name = NE, add to $arr2
  </code></pre>
  
  <p>I tried creating the dynamic arrays with New-Variable, but having issues trying to add to those arrays.  Is it possible to concatenate 2 variables names into a single variable name?  So taking $arr + $i to form $arr1 and $arr2 and $arr3, and then I can essentially just do $arr0 += $_</p>
  
  <p>The end goal is to group things based on CO, NE, IA for further sorting/grouping/processing.  And I'm open to other ideas of getting this accomplished.  Thanks for your help!</p>