in reply to Re^4: Illegal division by zero error
in thread Illegal division by zero error

Then you are probably not doing the right thing to skip "empty" lines. Or the line in question might not be really empty (there could be a new line character or some spaces that you can't see).

How do you skip empty lines? Perhaps you should remove spaces before (unless your lines have necessary spaces), or detect that the line doesn't have any character other than spaces.

We can't say for sure, not having seen your input, but it could be something like this:

next unless /\S/;
which will skip the line unless it contains any non-space character.