Not necessarily overkill in as that's pretty much what any such scheme is going to boil down to underneath; however it's certainly more verbose than it needs to be.
my $ctr = 0; my $class; while( $pointer = $sth->fetchrow_hashref ) { $class = ( ($ctr++) % 2 == 0 ) ? "even" : "odd"; ## ... }
Alternately there are JavaScript libraries which will go in and post-facto class-er-ize tables dynamically (which is nice if you're doing some Ajax fanciness and possibly reordering rows on the fly).
In reply to Re: Odd and even table rows
by Fletch
in thread Odd and even table rows
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |