Martin,thanks for the pointers to other nodes. I had done a super search but I used other keywords (copying, spanning). I hadn't heard of the knapsack problem. This is a great starting point. It actually nearly solves the complete problem.
I love perlmonks, there's always something new to learn.