# when $search_date is found beginning in the 52nd column # of a log entry that begins with 6 digits, then # print the matching line and the remainder of the file. my $gate = ''; for(){ if ( $gate || ($gate = /^\d{6}.{45}$search_date/)){ print RESULT; } }