in reply to grade calulator coding problem

You have DECLARED your subroutines, but not CALLEd them.

The code works if you add the calls around the "$average" caclulation, like:

div(); # CALL the sub named div $average=($g1 + $g2 + $g3 + $g4 + $g5 + $g6) / $div; letter(); #CALL the sub named letter
Of course, as others have pointed out, there is much room for code and coding style improvement.

Update:Here is a more concise, and idomatic version:

#!/usr/bin/perl use strict; use CGI qw|:standard|; my ($count,$total); my @gradeletter = qw| A A- B+ B B- C+ C C- D+ D |; # no F because that + is default; my @gradeval = qw|92.5 89.5 87.5 82.5 79.5 76.5 72.5 69.5 66.5 62.5 |; for(1..6){ my $value = param ("g$_"); $count++ if $value > 0; $total += $value; } $count ||=1; # Avoid divide by zero my $average = $total / $count; my $letter = "F"; # Default , unless a better one is found for (0..$#gradeletter){ if ($average > $gradeval[$_]){ $letter = $gradeletter[$_]; last; } } $letter = "INVALID" if $average > 100; print ul(li(" The letter grade is $letter" )), "\n";

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis