Hi, I am having a little trouble with a sub that is using the modulus
operator.

It is called here-within a while loop:
while (my $row = $sth->fetchrow_hashref()) {
        count++;
        color_rows( $count )
        ------some other stuff
        <td bgcolor="$bgcolor">table cell value</td>
        -----some other stuff
}
--here is the sub
sub color_rows
{
my $num = @_;
my $bgcolor;

If ( $num % 2 == 0 ) {
        $bgcolor="#bde6de";
} else {
        $bgcolor="white";
}
return $bgcolor;
}#end sub

I expect that when the value that is passed in $count is even it will
set the row color green, otherwise it will set it to white. What it is
actually doing is setting the value white every time. 

Thanks.

Ramon Hildreth
-------------------------------------------------------------------
[ www.subudusa.org ] [ www.subudseattle.org ]
                [ www.ramonred.com ]

Reply via email to