in reply to how to next line after the pattern in perl
while (<FF>) { next unless /XXXX/; print scalar <FF>; }
Note that scalar is required to turn the print statement into scalar context. There are other ways of accomplishing this (e.g. appending an empty string), but this is simple and clear, at least to me. Note that this is fragile in that it would miss consecutive lines.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to next line after the pattern in perl
by cliff52 (Initiate) on Sep 22, 2010 at 12:27 UTC |