Question: Write a perl script called subroutine.pl that assigns values to two variables, then calls the subroutine addplusone() with the two variables as arguments and assigns

Write a perl script called subroutine.pl that assigns values to two variables, then calls the subroutine addplusone() with the two variables as arguments and assigns the value returned by the subroutine to a variable.

The subroutine addplusone() adds 2 to the sum of the two arguments and returns the result.

For example, when the values 3 and 7 are assigned in the main program, the below sample run ensues:

$ perl subroutine.pl

Answer is 12

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!