i've an illegal division by zero error; i think that in the code, @elements1 and @elements1 are empty. Their content should normally come from the while loop "
while ((($debut, $fin) = $result =~ /debut\s+([0-9]+).+?fin\s+([0-9]+)/g) and $i < 2)", but it does not. Anyone can help me fix the problem please?

#!/usr/bin/perl -w
use strict;
use warnings;
use diagnostics;
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';

while ($line = $fh) #read each line from FILE.
{
chomp ($line);
while ((($debut, $fin) = $result =~ /debut\s+([0-9]+).+?fin\s+([0-9]+)/g) and $i < 2)
{
$length[$i] = $fin - $debut; # Calculation of the lenght of the first segment, then the lenght of the second segment
#push(@elements[$i], $length[$i]); #Push the 2 computed lenghts into a table to compute the mean of lenght for the 2 segments
$elements[$i] -> push($length[$i]);
$i++;
}
}
close $fh;
}