I would like to share the wisdom I gained.We come across situations when we need to generate a HTML table and stuff some data into it.If the table contains large number of rows we would use bi-(or)multi-color to make it easier to read and for some visual appeal. We can do it in a line of code
This keeps on swapping the colors for each row and code too will look neat and simple.Any more simplification welcomed!!@colors=("blue","green"); foreach $row(@rows) { print "<TR BGCOLOR=".$colors[push(@colors,shift(@colors))- +@colors].">".$row."</TR>"; }
In reply to Alternating colors for HTML Table's by narainhere
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |