so
$grades{$student} .= $grade . " "; is more like
$grades
No. It is this:
$grades{$student} = "$grades{$student}$grade ";
The value of $grade, followed by a space (" "), is appended to any existing value of $grades{$student}. The . operator does texual concatination, whereas += is numeric, and will add the right-hand-side to the left. For example:
$x = 3;
$y = 4;
$x .= $y; # gives 34
$x += $y; # gives 7