foreach my $value (@data) { $var = 1/($count-1); $variance = $var*(($value-$Average)**2); }