$comment_sth->execute($id) or die "Couldn't execute comment query: ".$DBI::errstr; my @comment_row; while (@comment_row = $comment_sth->fetchrow_array) { my ($speedtrap_id,$comment_id,$comment_text,$comment_date,$commenter) = @comment_row; if(@comment_row){ print < $comment_text EOF } else { print < There are no comments from others for this speedtrap. EOF }