while($ref=fetchrow_arrayref()){ push @ary,$ref; } foreach (@ary){ print "@{$_}\n"; }