in reply to Re: Average Price Algorithm
in thread Average Price Algorithm

If you add the line:

++$fragment{$frag}{$val};

following ++$fragment{$frag}{items}; in the innermost loop in the main block you record the quantities at each price that were used to achieve each person's package.

Oh, small nit (that may be covered by "I left it the way it is ...")- you didn't allocate anything to E because it wasn't included in %fragment.


Perl's payment curve coincides with its learning curve.