my $abort = 0; while (<$fh>) { chomp; if ($_ eq 'START' .. $_ eq 'END') { if ($abort) { $abort = 0 if substr($_, -2) eq 'E0'; next; } ... if (!/cool data/gi) { $abort = 1; next; } ... } }
Of course, it would be much simpler, safer, robust and clearer if you used an XML/HTML parser since you appear to be trying to parse XML/HTML.
In reply to Re: Breaking out of a matching block
by ikegami
in thread Breaking out of a matching block
by yoda54
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |