[ic] Item Discount Persists when clearing ALL_ITEMS

Mike Heins mike at perusion.com
Wed Feb 2 06:23:51 UTC 2011


Quoting Peter (peter at pajamian.dhs.org):
> On 02/02/11 13:48, Mike Heins wrote:
> > You can do
> > 
> > 	%{$Session->{discount}} = ();
> 
> Newer versions of Interchange use the $Discounts hashref instead, so the
> above code becomes:
> %$Discounts = ();

Either one should work, as they are the same hash reference....

> 
> > if you don't want to preserve the special ENTIRE_ORDER
> > and ALL_ITEMS discounts. If you do, then you could run:
> 
> delete @{$Discounts}{grep { !/^(ALL_ITEMS|ENTIRE_ORDER)$/ } keys
> %$Discounts}; # Untested, but should work.

Of course. But a lot of people would be surprised to find that
it saves mostly typing, and not much processor power. I try
and write for clarity when possible.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.328.4479  <mike at perusion.com>

"It is a remarkable fact that despite the worldwide expenditure of perhaps
US$50 billion since 1990, and the efforts of tens of thousands of scientists
worldwide, no human climate signal has yet been detected that is distinct
from natural variation." - Bob Carter



More information about the interchange-users mailing list