First off, your program does stop when it reaches the end of the file, that's just your trouble... you have a blank line just before the end of your file.
Perhaps you should check if the line has anything in it and stop parsing?
while (<FILE>) {
last unless /^\n$/;
do stuff();
}