@N; #array to store denominator for each question for ($j=0; $j<$numPercents; $j++){ $thePercents[$k][$j] = (($theArrays[$k][$j] / $N[$j]) * 100); $thePercents[$k][$j] = sprintf "%3.5f", $thePercents[$k][$j]; #I was trying to deal with the n.5 issue but this clearly won't work ... $factor = POSIX::floor($thePercents[$k][$j]); if (($thePercents[$k][$j] - .5) < $factor) { $thePercents[$k][$j] = POSIX::floor($thePercents[$k][$j]); } else { $thePercents[$k][$j] = POSIX::ceil($thePercents[$k][$j]); } }