title: how to substract from default variable in perl
body: <p>This is probably something very basic, but I couldn't find an answer to this elsewhere:</p>
  
  <p>it seems in an interation over an array I can add to a default variable to target other items in the array but I cannot substract from it, like so: </p>
  
  <pre><code>foreach (0..$#array) {
      if ( $array[$_] =~ m/PATTERN/ ) {
          $array[$_] = $TRING1;
          $array[$_+1] = $TRING2;
          $array[$_-1] = $TRING3;
      };
  };
  </code></pre>
  
  <p>It just doesn't assign anything to the previous item but leaves it as it was (I never get &lt;0). </p>
  
  <p>I'm probably missing something trivial here?</p>