http://qs1969.pair.com?node_id=637375

narainhere has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

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

@colors=("blue","green"); foreach $row(@rows) { print "<TR BGCOLOR=".$colors[push(@colors,shift(@colors))- +@colors].">".$row."</TR>"; }
This keeps on swapping the colors for each row and code too will look neat and simple.Any more simplification welcomed!!

Be inspired by Perl REGEX when you choose your spouse!!