title: Powershell: replacing in strings using a hashtable
body: <p>Okay, so I've set up a hash table with names being what to replace and keys being what to replace with, like this:</p>
  
  <pre><code>$r = @{
      "dog" = "canine";
      "cat" = "feline";
      "eric" = "eric cartman"
  }
  </code></pre>
  
  <p>What should I do next? I've tried this:</p>
  
  <pre><code>(Get-Content C:\scripts\test.txt) | Foreach-Object {
      foreach ( $e in $r.GetEnumerator() ) {
          $_ -replace $e.Name, $e.Value
      }
  } | Set-Content C:\scripts\test.txt.out
  </code></pre>
  
  <p>But it doesn't work at all, it just writes each line three times, without replacing anything.</p>
  
  <p>EDIT: Contains of test.txt:</p>
  
  <pre><code>dog
  cat
  eric
  </code></pre>
  
  <p>test.txt.out:</p>
  
  <pre><code>dog
  dog
  dog
  cat
  cat
  cat
  eric
  eric
  eric
  </code></pre>