Pater Nosters,
I am using a hash to recreate an HTML table with radios expressing previous choices for image alignment in this intuitive order: Left, Center, Right. Problem is that, of course, the hash keys are not ordered this way and can't be
sorted in any elegant way I can think of. Of course brute force can recreate the table as seen on previous pages with the appropriate radio selected but this means many more lines of code than I think should be needed. The current code is below. Any advice is, as always, greatly appreciated.
TIA
jg
my %top_align = ( Left => "left",
Center => "center",
Right => "right",
);
while (my ($k, $v) = each %top_align) {
if ($image_align_top eq $v) {
print qq|<td>
<div align="center">
$k <input type="radio" name="image_align_top"
+value="$v" checked>
</div>
</td>|;
} else {
print qq|<td>
<div align="center">
$k <input type="radio" name="image_align_top"
+value="$v">
</div>
</td>|;
}
}
_____________________________________________________It's not my tree.
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.