my $sth = $dbh->prepare("select NAME from data_template_data"); my $results = $sth->execute() or die "execute failed"; # the return value from $sth->execute() will be undef # if the query failed...otherwise the $results value # will contain the number of lines in that result set # # The DBI will return "0E0" to mean a true value with # a numeric result of "zero" to differentiate between # "didn't work" (undef) and "worked, but returned no rows" # this is the "logically true, but numeric false value". #To get the rows, use a while() loop.. # while ( (my $name) = $sth->fetchrow()) { print "name is $name\n"; }