Solution Review: Letter Grade to GPA
Understand how to create and manage a Perl subroutine that converts letter grades to GPA. Learn to pass parameters and use conditional if-elsif-else statements to return the correct GPA, reinforcing core Perl subroutine concepts.
We'll cover the following...
We'll cover the following...
Let’s look at the solution first before jumping into the explanation:
Explanation
We can get the passed parameter by using @_[0] and by using if elsif else statement, we can compare the passed parameter and return the GPA accordingly.