I am proceeding on the assumption that this is a homework assignment (due to the formatting and wording of the 'requirements'). Given that, perhaps a few questions to guide you on how process() might work:
- If you have CLEAR, what should it do to $total?
- Same question for each of the other operations.
- How do you pass update the value of $total outside of the process() subroutine?
Others may spoon feed you a solution, but I prefer helping you find the answer yourself.
- found in another location on the intertubes