title: Global variables and local variables in PowerShell
body: <p>I have global variables and want to use them within a function.</p>
  
  <p>I don't use local variables with the same name within the functions!</p>
  
  
  
  <pre class="lang-powershell prettyprint-override"><code># Global variables:
  $Var1 = @{ .. }
  $Var2 = @( .. )
  function testing{
      $Var1.keyX = "kjhkjh"
      $Var2[2]   = 6.89768
  }
  </code></pre>
  
  <p>I do it and it works, but is it safe or do I have to use the following?</p>
  
  <pre class="lang-powershell prettyprint-override"><code>$Global:Var1.keyX = "kjhkjh"
  </code></pre>