henry chen wrote:
I can't seem to figure out how to alternate the bgcolor for each row
that i'm printing from arrayref. Is there a 'foreveryother' function
that would allow me to put two lines in the loop? Or is there someway I
can put two rows of information and loop that? Here's what I have so
Instead of tracking an odd/even row number, you can initialize two
colors before the loop:
my ($ca, $cb) = ('red', 'green'); # Christmas-y!
Then inside the loop, always use $ca for the color, and just swap the
colors after you use them:
while (...blah) {
print qq[<tr style="background: $ca">];
($ca, $cb) = ($cb, $ca);
}
HTH
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>