Summing Subsets

So, the third challenge was to count the number of subsets of a set of numbers such that the largest number in the subset is the sum of the rest of the numbers in the subset. My first attempt was very straightforward: create all the subsets and check to see if they have the desired property:

For the explanation of how that works in more abstract terms than what I do:
1. We start with an array of how many ways we can get to a particular number given all the numbers smaller than the current one.
2. We add the current number to all numbers that could previously be reached to get the list of all numbers that can be reached using the current number and any of the previous numbers.
3. Pairwise add the list of previous counts to the ways we can get to numbers using the current number.
4. Step to the next number in our master set until exhausted.
5. sum up all the counts. Subtract out the number of elements in the master set because our count set contains the 1 element subsets which aren’t allowed in the problem.
My program merges steps 2 and 3 because as long as you go from the big numbers to the small numbers, you don’t need to keep track of the old counts. And messes up step 2 a little because I should have initialized @count as (1, 0 xx 99) so I could remove the @counts[$a]++. Also the .. 100 should be .. 99.