my $good_start = 0; while () { next unless (($good_start) || (/^start-of-data pattern/); $good_start = 1; # do things with the interesting lines }