use DBI; use Data::Dumper; use strict; use warnings; my $dsn = "DBI:mysql:database=test;host=foo"; my $dbh = DBI->connect($dsn, 'root', 'bar', {RaiseError => 1}); my $data = qq(SELECT person FROM or_mod); my $sth = $dbh->prepare($data); $sth->execute() or die $dbh->errstr; my @a; while(my $ref = $sth->fetchrow_arrayref) { push @a, $ref->[0]; } print Dumper(\@a); #### my @a = map {$_->[0]} @{$sth->fetchall_arrayref};