in reply to Re: Saving sql results to an array all rows?
in thread Saving sql results to an array all rows?
Here is the sorting code that I use in a separate script which is what I am having trouble incorporating to the @{$row_ref} array. I am guessing that I can't use @{$row_ref} name when running my sort? Any ideas or help would be greatly appreciated.foreach my $line (@lines) { $sth->execute($line, $line) or die "Can't execute SQL statemen +t: $DBI::errstr\n"; my @all_rows; while ( my $ref = $sth->fetchrow_arrayref()) { push(@all_rows, $ref); } foreach my $row_ref (@all_rows) { print "@{$row_ref}\n"; } }
sample of the sql output below. 2008-07-26 10.168.1.1 11122 3.3.3.3 80 hxxp://3.3.3.3 200 OKmy @sorted = map {$_->[0]} sort {$a->[1] <=> $b->[1] || $a->[2] <=> $b->[2] || $a->[3] <=> $b->[3] || $a->[4] <=> $b->[4]} map { [$_, split(/\./, (split /\s+/, $_)[1])]} @lines; print "$_\n" for @{$row_ref};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Saving sql results to an array all rows?
by Krambambuli (Curate) on Aug 18, 2008 at 19:27 UTC | |
by learningperl01 (Beadle) on Aug 19, 2008 at 15:26 UTC | |
by Krambambuli (Curate) on Aug 19, 2008 at 16:12 UTC | |
by learningperl01 (Beadle) on Aug 20, 2008 at 12:58 UTC | |
by Krambambuli (Curate) on Aug 20, 2008 at 13:07 UTC | |
|