KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Can I do something like the following in Perl? 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; } } Update: I need this in Perl, but for curiosity's sake: Do other languages have a neat syntax for that?
Tags (comma-separated)
Save Edits
Cancel