title: perl foreach loop in subroutine
body: <p>I know the subroutine in perl pass arg by reference. But in the below code, the foreach loop in the subroutine should not be changing the value for <code>@list</code> because the <code>my $i</code> should be creating a new lexically scope var <code>$i</code>. Any assignment to <code>$i</code> should be lexically scope but not changing the <code>@list</code> value.</p>
  
  <p>Can anyone explain what is happening inside the foreach loop that causes the value change to <code>@list</code>?</p>
  
  <pre><code>sub absList {    
      foreach my $i (@_) {
          $i = abs($i);
      }
  }
  
  @list = (-2,2,4,-4);
  absList(@list);
  print "@list";
  </code></pre>
  
  <p>Outputs:</p>
  
  <pre><code>2 2 4 4
  </code></pre>