The above %columns hash uses numbers as keys, if inside the if statement, count the number of keys, increment the result and assign the value to the hash.for my $discount (@discounts) { if ($discount == 1) { my $key_num = scalar keys %columns; $key_num++; $columns{$key_num} = 1; } }
In reply to Hash key counting by blackjudas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |