By default, the method selectcol_arrayref returns a ref to a list containing the elements of the first column of the result set of the select statement:
#!/usr/bin/perl
use warnings;
use strict;
use DBI;
unlink 'the.db' if -e 'the.db';
my $dbh = DBI->connect('dbi:SQLite:dbname=the.db') or die "Could not create the.db";
$dbh -> do('create table tab(col1, col2, col3)');
my $sth = $dbh -> prepare('insert into tab values (?, ?, ?)');
$sth -> execute('foo', 'one' , 'abc');
$sth -> execute('bar', 'two' , 'def');
$sth -> execute('baz', 'three', 'ghi');
for (@{$dbh -> selectcol_arrayref('select col1 from tab')}) {
print "$_\n";
}
#
# foo
# bar
# baz