in reply to grade calulator coding problem

I have no experience with such things, but perhaps Troubleshooting Perl CGI scripts will help you.

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;