peppiv has asked for the wisdom of the Perl Monks concerning the following question:
If I put the print statement inside the while loop, each array prints all three rows. If I print outside the while loop, it prints only the last row for each array.$sth->execute() or die $sth->errstr; my $row = 0; while (my @result = $sth->fetchrow_array()) { last if $row++ >= 3; if ($row = 1){ @x = @result; } if ($row = 2){ @y = @result; } if ($row = 3){ @z = @result; } } print qq(@x<br><br>); print qq(@y<br><br>); print qq(@z<br><br>); $sth->finish();
|
---|