There are many simple ways to do this. I would look at Data::PowerSet to generate sets of all numbers to sum, or program it myself by using the binary digits of a counter to indicate whether an element should be included:
00000 # (no element summed) 00001 # e 00010 # d 00011 # d+e 00100 # c ... 11111 # a+b+c+d+e
What code have you written and where do you have problems?
In reply to Re: Sum of N elements in an M element array
by Corion
in thread Sum of N elements in an M element array
by abhay180
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |