The next doesn't exit the loop, it reiterates it, i.e. goes back to its start and checks it condition. The condition reads in a new line, but it doesn't change neither $count nor $start. So, the next at line 16 is called for every line of the log.
BTW, to keep track of the input file line numbers, you can use $..