in reply to parsing large files for something
Don’t be flummoxed by the “large” size of the file. (To Perl, it isn’t large at all.)
You have two kinds of lines you are looking for: “code” lines, and “decision” lines. What you care about in the first case is to capture $last_code_seen. In the second case, if (defined($last_code_seen)) { ..., you want to make your decision.
Perl munches on “several hundred megabyte” files as a midnight snack.