in reply to Re^7: Saving sql results to an array all rows?
in thread Saving sql results to an array all rows?
Current code$VAR1 = '2008-07-26 10.10.10.1 3.3.3.3 80 hxxp://3.3.3.3 200 OK'; $VAR14 = '2008-07-26 192.168.1.32 11122 3.3.3.3 80 hxxp://4.4.4.4 200 +OK'; $VAR29 = '2008-07-26 1.1.1.1 11122 3.3.3.3 80 hxxp://3.3.3.3 200 OK';
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 ); } my @sorted1 = map { join( ' ', @{ $_->[0] } ) } sort { $a->[1] <=> $b->[1] || $a->[2] <=> $b->[2] || $a->[3] <=> $b->[3] || $a->[4] <=> $b->[4] } map { [$_, split(/\./, $$_[1] ) ] } @all_rows; my @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] ) ] } @sorted1; my @all_rows1 = map { [ split( /\s+/, $_ ) ] } @sorted; print Dumper ( @sorted ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Saving sql results to an array all rows?
by Cristoforo (Curate) on Aug 20, 2008 at 20:45 UTC | |
by learningperl01 (Beadle) on Aug 21, 2008 at 15:21 UTC | |
by Cristoforo (Curate) on Aug 21, 2008 at 16:10 UTC | |
by learningperl01 (Beadle) on Aug 21, 2008 at 17:33 UTC | |
by learningperl01 (Beadle) on Aug 21, 2008 at 17:52 UTC | |
|
Re^9: Saving sql results to an array all rows?
by Krambambuli (Curate) on Aug 20, 2008 at 17:06 UTC |