in reply to
How can I calculate the right combination of postage stamps?
Maybe I missed the bin-packing module on CPAN.
Yep, Algorithm::BinPack. There are a couple others, too, but that's the one I've used and it worked (was very happy :).
UPDATE: I got distracted by your actual problem, which I don't think is solved by the bin-packing algorithm. I'm also not formally trained in CS. :} I found this link which seems to explain the problem for the case of coins (which are practically stamps): The Coin Changing Problem