Disclaimer: Not tested.
Maybe something like this:
my $getPatterns; while (<>) { if (/^#ERRORS/ .. /^CELLS/) { push(@errors, $_); $getPatterns = 1; next; } elsif (defined $getPatterns) { push(@errors, $_); $getPatterns = undef if (/^\s*$/); next; } ...; # other processing } print "Errors:\n"; for (@errors) { print " $_"; }
Update: I think this could be written as:
Update 2; No, it won't work.
while (<>) { if (/^#ERRORS/ .. /^CELLS/) { push(@errors, $_); } elsif (/^CELLS/ .. /^\s*$/) { push(@errors, $_); } else { ...; # other processing } } print "Errors:\n"; for (@errors) { print " $_"; }
In reply to Re: print content of array individually after parsing multiple input files
by RonW
in thread print content of array individually after parsing multiple input files
by teddy6507
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |