while (my @kp_src_t_row=$sth->fetchrow_array()) { for ($column=0; $column<@kp_src_t_row; $column++) { $currentarray[$kp_num][$column] = $kp_src_t_row[$column]; } $kp_num++; } #### while (my @kp_src_t_row=$sth->fetchrow_array()) { $currentarray[$kp_num]= @kp_src_t_row $kp_num++; }