($line) = $sth->fetchrow_array() #### while (($line) = $sth->fetchrow_array()) { push(@all_rows, $line); } foreach (@all_rows) { print "$_\n"; } #### while ( (@record) = $sth->fetchrow_array()) { push(@all_rows, \@record); } foreach my $row_ref (@all_rows) { print "@{$row_ref}\n"; }