... if (0 < $lines_to_skip) { if ($line =~ /datestamp-regex/) { next LINE; } # we are at the next date stamp line so fall through, etc. } ...