foreach my $line (@lines) { if ($line =~ m/\[foo\]/) { print $line; # I do not want this line # how do I print the next lines in @lines # until I reach [foo2]? # once I get to [foo2] I want to print out # everything there also } }
File:
; ; foo file ; [foo] a=1 b=2 c=3 [foo2] d=4 e=5 f=6
In reply to How do you move within an array using foreach? by P0w3rK!d
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |