alternate( sub { $sth->fetch }, sub { print $row }, sub { $id }, # which variable to monitor sub { print "" } # what to do when variable changes );