# skip old entries: while () { if (/^\s*([\d\/\-]+\s+[\d\.\:]+)\s+/) { next if ( (time() - str2time($1)) > $serverRef->{ScanErrlogLastDays}*24*3600 ); $ref->{start_check_datetime} = $1; last; } } # scan the entries: while () { …