1
2
3
4
5
6
7
my @res;
my $row;
while ($row = $query->fetchrow_arrayref){
print "$row->[0] : $row->[1] : $row->[2]";
push @res, $row;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
my @res;
my $row;
while ($row = $query->fetchrow_arrayref){
print "$row->[0] : $row->[1] : $row->[2]";
push @res, $row;
}
print "---------------------------------------";
foreach $row (@res) {
print "$row->[0] : $row->[1] : $row->[2]";
}
1
2
3
4
5
1 : LANGUAGE : de_DE
2 : LANGUAGE : en_US
---------------------------------------
2 : LANGUAGE : en_US : ARRAY(0x1417df0)
2 : LANGUAGE : en_US : ARRAY(0x1417df0)
QuoteNote that the same array reference is returned for each fetch, so don't store the reference and then use it after a later fetch.
https://metacpan.org/pod/DBI#fetchrow_arrayrefNote that the same array reference is returned for each fetch, so don't store the reference and then use it after a later fetch. Also, the elements of the array are also reused for each row, so take care if you want to take a reference to an element. See also "bind_columns".