title: Find combinations of numbers that sum to some desired number
body: <p>I need an algorithm that identifies all possible combinations of a set of numbers that sum to some other number.</p>
  
  <p>For example, given the set <code>{2,3,4,7}</code>, I need to know all possible subsets that sum to <code>x</code>. If <code>x == 12</code>, the answer is <code>{2,3,7}</code>; if <code>x ==7</code> the answer is <code>{{3,4},{7}}</code> (ie, two possible answers); and if <code>x==8</code> there is no answer. Note that, as these example imply, numbers in the set cannot be reused.</p>
  
  <p>This question <a href="https://stackoverflow.com/questions/83547/algorithm-to-find-which-numbers-from-a-list-of-size-n-sum-to-another-number">was asked on this site a couple years ago</a> but the answer is in C# and I need to do it in Perl and don't know enough to translate the answer.</p>
  
  <p>I know that this problem is hard (see other post for discussion), but I just need a brute-force solution because I am dealing with fairly small sets.</p>