As dHarry says, you're probably best off having the database sort your results.
If you want to get every row, use a DBI method that does that. For example:
$sth->execute( $line, $line ) or die ...; my @all_rows = @{ $sth->fetchall_arrayref() };
At that point, every element in @all_rows is an array reference. The first row is $all_rows[0]. The first column of the first row is $all_rows[0][0].
If you want, you can get an array of hash refs instead. I find these more useful because you can refer to the fields by name.
my @all_rows = @{ $sth->fetchall_arrayref( {} ) };
In that case, $all_rows[0] is still the first row, but it's a hash ref instead. Then you can do $all_rows[0]{srcaddr} for that field in that row.
If you want to output the whole structure, Data::Dumper is good for that, or see How can I visualize my complex data structure?.
In reply to Re: Saving sql results to an array all rows?
by kyle
in thread Saving sql results to an array all rows?
by learningperl01
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |