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.