$key_num always has the same value because you are always setting it to the same value. You are first setting it to the number of keys in %columns $key_nums = keys %columns;, and then you increment it by 1 $key_nums++;. You do this for every value in @discounts that has a value of 1?
It's completely unclear from your question what it is that you are actually trying to do....a written description of your requirement would probably clarify this.
In reply to Re: Hash key counting
by BrowserUk
in thread Hash key counting
by blackjudas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |