Unrelated to your problem... a loop can make your code more scalable and less error-prone (UNTESTED):
use CGI ':standard'; use warnings; use strict; my $total = 0; my $div = 0; for (1 .. 6) { my $g = param('g' . $_); if ($g ne '') { $total += $g; $div++; } } die "Error: div by 0" if $div == 0; my $average = $total/$div;
In reply to Re: grade calulator coding problem
by toolic
in thread grade calulator coding problem
by friar tux
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |