data67 has asked for the wisdom of the Perl Monks concerning the following question:
The file format of the data file is (delimited with "!"s):
1018884184639!1!2!3!4!5!6!7!8!9!10!11!12!http://www.perlmonks.com!Fri +Mar 29 10:32:44 2002! 1017939028902!1!2!3!4!5!6!7!8!9!10!11!12!http://perlmonks.com!Fri Mar +29 10:32:44 2002! 1017939144004!1!2!3!4!5!6!7!8!9!10!11!12!http://perlmonks.com!Fri Mar +29 10:32:44 2002!
And here is what my code looks like so far:
use DBI; $dbh = DBI->connect("DBI:CSV:f_dir=/export/home/devtools") or die "Cannot connect: " . $DBI::errstr; # reading "devtools.data" as a table: $dbh = DBI->connect(qq{DBI:CSV:csv_sep_char=\\!}); $dbh->{'csv_tables'}->{'devtools'} = { 'file' => 'devtools.data'}; $dbh->{csv_tables}->{'devtools'}->{skip_rows} = 0; $dbh->{csv_tables}->{'devtools'}->{col_names} = [qw(id pp midd fos db dbt dlang fil dtools stools scm tt dest +url lastupdate )]; $sth = $dbh->prepare("SELECT id, url FROM devtools"); $sth->execute() or die "Cannot execute: " . $sth->errstr(); #DBI->trace(1); while ( ( $id, $url) = $sth->fetchrow_array) { print "ID is - $id , and url is - $url\n"; } $sth->finish();
ID is - 1018884184639 , and url is - http://www.perlmonks.com
Why is it not going through the whole file? WHat am i not doing right.
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: reading files with DBD::CSV
by jeffa (Bishop) on Jun 14, 2002 at 15:41 UTC | |
by data67 (Monk) on Jun 14, 2002 at 16:09 UTC | |
|
Re: reading files with DBD::CSV
by SarahM (Monk) on Jun 14, 2002 at 15:16 UTC | |
|
Re: reading files with DBD::CSV
by data67 (Monk) on Jun 14, 2002 at 16:25 UTC |