wrote:
> I am reading each record from an input text file using the foreach
> loop.
Really? Why? That's rather unnatural. Can you show us what you mean
(please see posting guidelines).
> Once my search of a pattern in a record is true - i want to skip
> next n lines.
>
> How do i get this done,
In general the way to have a foreach skip is something like...
my $skip;
foreach ( whatever ) {
if ($skip) { $skip--; next }
if ( some_condition ) {
$skip = 5;
}
}
But if you took the conventional approach of reading the file a line at
a time in a while loop is would be simpler. Then you could just read
and discard some lines.
local *_;
while ( <$filehandle> ) {
if ( some_condition ) {
<$filehandle> for 1 .. 5;
}
}