use List::Util 'reduce'; sub total { return reduce { $a + $b } 0, @_; }