in reply to Having problems with addition in sub

First, praise for using strict!

...and now couple more nits....
  1. By adding use warnings; perl would have told you some useful information.
  2. In total(), $number is not initialized. Sure you can ass-u-me that perl will set it to 0 but it will save you time and head ache later if you get in the habit of initializing all your variables (i.e., my $number = 0;)