Krambambuli I followed your example and I get all rows/results correctly. Now the only problem/thing that I do not know how to deal with is the @{$row_ref} array? If I wanted to run the sorted code which runs against an array passing it the @{$row_ref} array does not work. I get an array code ARRAY(0x9019330) on the screen here is the code that I am using currently. Thanks for the help!!
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";
}
}
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.
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])]} @lines;
print "$_\n" for @{$row_ref};
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 OK
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.