Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: For statement 2 html table

by SamCG (Hermit)
on Jan 03, 2006 at 22:59 UTC ( [id://520758]=note: print w/replies, xml ) Need Help??


in reply to For statement 2 html table

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://520758]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2024-04-23 14:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found