0
我最近發現有一個selectrow_array
函數可以從數據庫中獲取值。我在使用它時遇到以下錯誤。我想知道這裏有什麼問題,找不到替代方法來做到這一點。在Perl中使用selectrow_array獲取2個值
代碼是:
my $db_connection = DBI->connect($dsn, $dbuser, $dbpassword) or die $DBI::errstr;
my $sql_statement = "SELECT customer_id,quota FROM customer_call_quota WHERE quota>=1";
while (my $row = $db_connection->selectrow_array($sql_statement)) {
my ($cust_id, $quota) = @$row; #<---- error line
}
my $rc = $db_connection->disconnect ;
return "ok";
錯誤:
Can't use string ("value") as an ARRAY ref while "strict refs" in use at code.pl line ...
啊,它只是返回的第一行。感謝你的回答! –
是的,但實際上是導致錯誤的其他問題 – ikegami