use strict; use warnings; my $statement = "select foo, bar from mytable"; my $ary_ref = $dbh->selectall_arrayref($statement); if ($DBI::errstr) { # do something, your select failed! } my @rows = (); @rows = @{$ary_ref} if ref($ary_ref) eq 'ARRAY'; foreach my $thisrow (@rows) { my @columns = (); @columns = @{$thisrow} if ref($thisrow) eq 'ARRAY'; foreach (@columns) { print "$_\t"; } print "\n"; }