in reply to Odd and even table rows

A less verbose way of doing the same thing would be:

my $i=0; while ($pointer = $sth->fetchrow_hashref){ my $class = ("even","odd")[$i++%2]; ...more stuff goes here.... }

citromatik

Replies are listed 'Best First'.
Re^2: Odd and even table rows
by wind (Priest) on Aug 09, 2007 at 04:03 UTC
    Or a variation on yours and GrandFather's replies:
    my $t; while ($pointer = $sth->fetchrow_hashref){ my $class = qw(even odd)[$t^=1]; ... }
    - Miller