# some simple binary operators sub plus { $_[0] + $_[1] } sub times { $_[0] * $_[1] } # build n-ary operators from them *sum = foldl_c( \&plus, 0 ); *product = foldl_c( \×, 1 ); # test them out say sum(1..10); # 55 say product(1..10); # 3628800