Forgive me for asking, but what does "using the same IF statement... " actually mean? Do you mean you want to use only one "for" loop starting "for my $i (@$times)"?
For that matter, I'm also not sure what you mean by "OUTPUT IS SOME WHAT SIMILAR TO THIS BUT IS USING
tags: " -- though I think I understand what output you're getting from the code.
Forgive me for asking, but are you familiar with html?
Enforcing the "IF" restriction doesn't seem wise, since if you want a table you'll be iterating through rows, and would need to access the images successively, then the $i successively, etc. The
easiest (definitely far from best) way to do this might be to set up a loop for the four rows of your table, and to print a different element into each td element depending on which row you were in.
untested semi-code follows
use Switch;
for my ($x=0;$x<4;$x++){
switch ($x)
case 0
for my $i (@$times) {
print qq{<td><img src="$icons->{$i}" alt="" /></td>};
}
case 1
for my $i (@$times){
print qq{<td>"$i"</td>};
}
etc., etc.
Note you will still need to insert the table and tr tags. Someone will probably (maybe already) suggest you do something else entirely, like use CGI and a templating system, or give a better method of doing something like the above. They're probably right (and will probably lambast me for suggesting such a clumsy solution). I just wanted to give you something that might work, and not require complete overhauls.
I might have misunderstood your question. I tend to have some difficulty reading sentences in all caps.
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.