my $sth = $dbh->prepare( "SELECT COUNT(*) FROM table WHERE username != \"me\"" ) or die DBI->errstr; $sth->execute( ) or die DBI->errstr; my ( $count ) = $sth->fetchrow_array();