Arjen#!/usr/local/bin/perl use strict; use warnings; my @ctx_starters = qw(start1 start3); while (my $line = <DATA>) { if (grep { $line =~ /$_/ } @ctx_starters) { print $line; INNER: while ($line = <DATA>) { next INNER if $line !~ /^end/; print $line; last INNER; } } else { print $line; } } __DATA__ start1 foo bar end start2 baz quux end start3 bla bla end start4 hmm end start5 last one here end
In reply to Re: File parsing-again
by Aragorn
in thread File parsing-again
by sashac88
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |