title: How to dynamically create an array and use it in Powershell
body: <p>I need to create and then use arrays but I need to create dynamically. I'm developing script to get the app pools memory, but when we have more than 1 worker process i need to store in array the memory and then calculate the average.</p>
  
  <p>I'm using this to create it</p>
  
  <pre><code>New-Variable -Name "Array_$($AppPoolName)" -Value @()
  </code></pre>
  
  <p>But I don't know how to add data to the array using a dynamic name as I would do it when I use a fixed name (<code>$var += &lt;Value&gt;</code>).</p>