selectrow_arrayref()
$dbh->selectrow_arrayref($sql_statement[, \%attri][, @values])
This function returns a reference to an array of one row
from the results of an SQL statement given. This method combines
prepare(),
execute(), and fetchrow_arrayref(). An optional
second argument can specify any of the attributes allowed for a
statement handle. If placeholders are used in the SQL statement, their
values must be given as an array for the third argument. Here is an
example:
...
my $sql_stmnt = "SELECT title, author
FROM books WHERE book_id = ?";
my $book = $dbh->selectrow_arrayref($sql_stmnt, undef, '1234');
my ($title, $author) = @$book;
print "$title by $author \n";The prepare() method isn’t called to
create a statement handle if the SQL statement is given (as it is
here), which means finish() is unnecessary.
However, a statement handle could be given instead.