your sum is in $result, so return $result
update: no need for '&' before add
In reply to Re: Returning Values from Subroutines by fglock in thread Returning Values from Subroutines by johnirl