while (my $in = <IN>){ foreach (@ref){ if ($_=~ m/$in/){ print OUT "$_"; }}}
What if I would like to print out not $_ but the next iteration $_+ so to say. It has became a general problem to me. I regularily want to test an array element for a condition and then according to this retrieve another array element some steps "upstream". (Sorry about my language but I hope these expressions are able to carry my meaning)
Using loop control commands like next or redo seems kind of too brutal for this kind of work, I would like to hear your what methods do you suggest - and if possible a sample using the case above -- only instead of printing out $_ to print out $_ next value.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |