Your script executes line 15 if index($F[4],','); returns -1, which means if the comma isn't found. There are two obvious situations where the comma would not be found: (1) The input data has at least ten fields but there is no comma in the tenth field, or (2) The input data doesn't have ten fields. The second situation can happen, as an example, if your script encounters an empty line. Essentially, you're not handling blank lines or lines that don't conform to expectations. Even in a really sanitary data set, a blank line will often occur at the end of the file. If every line of the input ends with a \n, then the last useful data line also has a newline at the end, leaving an empty line after it. Solve the problem by skipping empty lines. Right after your chomp, put a sanity check: next unless length $_;
Dave
In reply to Re: Illegal division by zero error
by davido
in thread Illegal division by zero error
by TJCooper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |