Read the file line by line, and if one line matches your pattern, store that information in a variable. Previously to matching, you print out the current line if that same variable indicates the the previous line matched.
See also: perlintro, Super Search
Perl 6 - links to (nearly) everything that is Perl 6.