my @input = ; my $counter = 0; my $start_time; # this finds the date we are looking for # and stores its array location # sample of the lines we are looking at -> # 20020111 164741 892 26,212 Directories 52,846 Files (805.49 MB) Backed Up to Media. foreach $_ (@input) { $counter++; if (/$date/) { $start_time = $counter; last; } } # last line my $end = $#input; # if log file is blank if ($start_time eq 0) { $start_time = $end; } # print summary to another log foreach $_ (@input[$start_time..$end]) { print LOGFILE "$_"; }