- or download this
my $lastid = 0;
while ($sth->fetch) {
...
print "</tr><tr>";
}
}
- or download this
alternate(
sub { $sth->fetch },
...
sub { $id }, # which variable to monitor
sub { print "</tr><tr>" } # what to do when variable changes
);
- or download this
sub alternate {
my $iter = shift;
...
sub { $type },
sub { print "</td><td>" }
);