ssandv gave you a good pointer. because from the code that you presented you are looping through a whole file and printing stuff, then exiting the loop keeping the file handle opened (which i strongly disapprove), then trying to capture something from the filehandle and then again repeating the first step.you gotta admit you intentions are a bit confusing ;) maybe something like this will help:
this wasn't tested due to having nothing to test it on, but you can try to embed it and try it on a real data to see...use strict; ... my $trigger = 0; while(<$in>){ print $out $_ if ($trigger == 0); $trigger = 1 if ($_=~/match something|or something else/g); $trigger = 0 if ($_=~/match something|or something else/g); }
cheers
In reply to Re: skipping lines when parsing a file
by baxy77bax
in thread skipping lines when parsing a file
by lomSpace
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |