sub addArray{ shift(@_) + addArray(@_) if(@_) } $total = addArray( 1, 3, 8, 15, 7, 5, 3 )