$arrayRef = $dbh->selectrow_arrayref("SELECT password FROM table WHERE username = '$username'") or die "Error: " . $dbh->errstr; #### $sth = $dbh->prepare("SELECT password FROM table WHERE userName = '$userName'") or die $dbh->errstr; $result = $sth->execute(); print "There were no rows returned\n" if $result == 0;