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

There are many ways that the relevant code block could be entered. Maybe you want to print out the line that is processed, together with the values stored in @array and the values stored in @F to determine what the line looks like instead of guessing that it must be an empty line?

Replies are listed 'Best First'.
Re^6: Illegal division by zero error
by TJCooper (Beadle) on Feb 01, 2016 at 17:03 UTC
    When using print OUT "@F\n", the final line is simply a blank line (unless it contains special characters I cannot see) - although no such line appears on the input. This is also true of @array and printing the non-split line.

      Why do you print out @F when you want to inspect the contents of $_?

      Maybe you want to add the following line in a strategic place of your script?

      print "Now processing [$_]\n";

      Consider also adding

      use Data::Dumper; print Dumper \@F; print Dumper \@array;

      ... after you've populated @F and @array.