in your example the variable $row_count can only have two
possible states, either 0 or 2. increment the variable every
time you iterate the loop to set it to the actual row you have
currently or use something more compact like this:
#!/usr/bin/perl
use warnings;
use strict;
my $total_sites = 20;
my $rows = 4;
print qq|
<table border="1" width="100%" cellpadding="3" cellspacing="3">\n
<tr>\n|;
for my $i (1 .. $total_sites) {
print "\t<td>number: [$i]</td>\n";
print "</tr>\n<tr>\n" unless ($i % $rows || $i == $total_sites);
}
print "</tr>\n\n</table>\n";
snowcrash