I prefer moritz's solution (while (<>) { $f and print; $f = /XXXX/; }) to lidden's, because it works well even if the pattern matches two consecutive lines.
See also my cgrep: Egrep clone with function name display for something similar, it can do context grep, that is, print a number of lines after and before a line matching a pattern.
In reply to Re: how to next line after the pattern in perl
by ambrus
in thread how to next line after the pattern in perl
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |