title: Powershell : Why I cannot use ForEach-Object to modify elements?
body: <p>I've got an array definition:</p>
  <pre><code>&gt; $a={&quot;abc&quot;,&quot;xyz&quot;,&quot;hello&quot;}
  </code></pre>
  <p>Then, using foreach to modify it, but seems original elements are not changed:</p>
  <pre><code>&gt; foreach($i in $a){$i=&quot;kkk&quot;+$i}
  &gt; $a
  &gt; &quot;abc&quot;,&quot;xyz&quot;,&quot;hello&quot;
  </code></pre>
  <p>Why foreach loop doesn't modify elements?
  Then I tried to use ForEach-Object, this time, it doesn't even run:</p>
  <pre><code>&gt; $a|%{$_=$_+&quot;kkk&quot;}
  Method invocation failed because [System.Management.Automation.ScriptBlock] does not contain a method named 'op_Addition'.
  At line:1 char:6
  + $a|%{$_=$_+&quot;kkk&quot;}
  +      ~~~~~~~~~~~
  + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException
  + FullyQualifiedErrorId : MethodNotFound
  </code></pre>
  <p>Does this has any syntax error? Or my understanding is incorrect?</p>