selectrow_array
@row_ary = $dbh->selectrow_array($statement); @row_ary = $dbh->selectrow_array($statement, \%attr); @row_ary = $dbh->selectrow_array($statement, \%attr, @bind_values);
This
utility
method combines prepare
,
execute
, and fetchrow_array
into a single call. If called in a list context, it returns the first
row of data from the statement. If called in a scalar context, it
returns the first field of the first row. The
$statement
parameter can be a previously prepared
statement handle, in which case the prepare
is
skipped.
If any method fails, and RaiseError
is not set,
selectrow_array
will return an empty list.
In a scalar context, selectrow_array
returns the
value of the first field. An undef
is returned if
there are no matching rows or if an error occurred. Since that
undef
can’t be distinguished from an
undef
returned because the first field value was
NULL, calling selectrow_array
in a scalar context
should be used with caution.