in reply to DBD::Mysql Strange Locking error

Why loop through all the results when you only want the first row? (see DBI for method descriptions)
sub getsqlvalue { my ($dbh,$sqlstatement)= @_; my ($value) = $dbh->selectrow_array($sqlstatement) or die "Could n +ot execute MySQL statement: '$sqlstatement' " . $dbh->errstr; return $value; }
(i know, doesn't answer primary question, but goes to efficiency)