$sql = "select * from table limit 10"; $sth = $db->prepare($sql); $sth->execute() or die "SQL Error: $DBI::errstr\n"; my $rows = $sth->fetchall_arrayref({ Slice => {}}); foreach my $row ( @$rows ) { print $row->{'id'}, "\n"; } #### $sth->execute or die "SQL Error: $DBI::errstr\n"; while (@row = $sth->fetchrow_array) { print $row[0], "\n"; }