This example is an over-simplified form of what the code actually looks like. @discounts contains a large number of elements that have a value of either 0 or 1.
If the element contains a 1 %columns is assigned a new key (name is based on how many keys actually exist in %columns) with a value of 1.