foreach my $line () { # Do following for each line infile chomp $line; if ($line =~ /^\b\d/){ # Skip lines that contain text ($timestamp, undef, $out, undef, undef, undef, $in, undef)=split(/\t/, $line); # Sort out needed columns my $seconds = ($timestamp - $last_time); # Determine elapsed time if ($seconds > .00012){ # For time longer than 10 seconds my $time = DateTime::Format::Excel->parse_datetime($timestamp); # Format time/date my $logdate = $time->ymd; # Date format my $logtime = $time->hms; # Time format my $error_name = "$center Error Log $log_time"; open(PACKETS,">> /directory/logs/error_log.txt"); print PACKETS "Packet lost on $logdate at $logtime\n" or die "Can't open file $!"; # Write to log file } $last_time = $timestamp; # Store as previous time to compare