title: Can I pull the next element from within a Perl foreach loop?
body: <p>Can I do something like the following in Perl?</p>
  
  <pre><code>foreach (@tokens) {
       if (/foo/){
         # simple case, I can act on the current token alone
         # do something
         next;
      }
      if (/bar/) {
         # now I need the next token, too
         # I want to read/consume it, advancing the iterator, so that
         # the next loop iteration will not also see it
         my $nextToken = .....
         # do something
         next;
      }
  
  }
  </code></pre>
  
  <p><strong>Update:</strong> I need this in Perl, but for curiosity's sake: Do other languages have a neat syntax for that? </p>