Thanks, but alas, that didn't work for me when I tried to make the columns a different width. On my system, to make your code run, I had to provide a width to the table, in your call to table's constructor. That aside, the colours and aliognment worked fine, regardless of the presence or absence of the leading hyphens. And while it seems easy to make the columns equal width, there seems to be no way to make the right column consistentlly to take one fifth of the table width and the left column to take the rest.
But to get a better test, try making the values in the left column arbitrary strings of variable length, and the right columns random currency values from $0.00 up to $999,999.99, and have three or four tables that use the same column properties, similar variability in the length of the strings in the left column but order of magnitude differences in the currency values between the tables (i.e. if in the first table the values are of the order of $10,000, make those in the second table of the order of $10, and those in the third of the order of $100,000). What you will see is that the layout of each table adapts to the data it is presenting, instead of the specs in the column properties. It is late, but I will work up an example of this sort in the morning, unless someone beats me to it.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||