title: Perl - splice() issues
body: <p>I'm having trouble using the perl splice() method. Bellow you will see that I first identify the indexes of the two strings that I am looking for and then perform splice() using the indexes to get the desired array.</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>my @a = qw(foo bar bazz elements in between hello bazz johnny bl aba);
  my $z = 0;
  
  for (my $i = 0; $i &lt; @a; $i++)
  {
      next unless $a[$i] =~ /bazz/;
  
      if( $z eq 0 )
      {
          $z++;
          $first = $i;
      }
      else
      {
          $second = $i;
      }               
      my @b = splice(@a,$first,$second);
      print Dumper(@b);
  }
  </code></pre>
  
  <p>And the result of the print is as follows:</p>
  
  <pre><code>$VAR1 = 'bazz';
  $VAR2 = 'elements';
  $VAR3 = 'in';
  $VAR4 = 'between';
  $VAR5 = 'hello';
  $VAR6 = 'bazz';
  $VAR7 = 'johnny';
  </code></pre>
  
  <p>I was under the impression that splice takes the chunk in between the given limits, inclusive of course. I don't understand why element 'johnny' would be there. Shouldn't the list stop at the second 'bazz' ?</p>
  
  <p>Thank you for any pointers on this issue.</p>