my $table = $sth->fetchall_hashref; for my $r (@$table) { #### while(my $r=$sth->fetchrow_hashref ){