The explanation of what I'm trying to do is going to be somewhat unclear, it is part of a database handler which parses output and creates HTML tables based on user selections. The %columns hash contains descriptors which (if valid) are parsed and a table is put together at a later time.
I have gone over the logic, the @discounts array contains a number of elements which have either a value of 0 or 1. If the current element has a value of 1, then count how many keys are in columns.
%columns = (
1 => 1,
2 => 1,
3 => 1,
4 => 1
);
In this case, I ask for how many keys are in %column, increment by one and move forward, so the above should return 4 += 1 = 5.
Then assign:
$columns{5} = 1;
Loop again, return a count of 5, increment and assign:
$key_num = keys %columns # 5
$key_num++; # 6
$columns{6} = 1;
Is that a little more clear?
BlackJudas
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.