http://qs321.pair.com?node_id=565983


in reply to Re^3: Quickest way of fetching a Single row and column in MySQL using DBI
in thread Quickest way of fetching a Single row and column in MySQL using DBI

Scalar context works as well according to the DBI source code:

sub selectrow_array { my $row = _do_selectrow('fetchrow_arrayref', @_) or return; return $row->[0] unless wantarray; return @$row; }

The docs hint that this should work as well, but don't explicitly state it. Instead the docs mention this:

If called in a scalar context for a statement handle that has more than one column, it is undefined whether the driver will return the value of the first column or the last. So don't do that.

Anyway, it won't hurt to add the brackets in there to force list context, but it shouldn't be required.