Can anyone help identify why following code block will fetch only one row when csv_tables->{skip_rows} is set to 0? A solution for this will go a long way toward solving a more complex scenario I'm attempting to help someone with. I would think the actual vs expected indicates an issue with 'csv_eol' param but I've burned much time trying various settings. I have switched row1 and row2 - script then shows just '4,1,2,3' output row. Thanks.
Platform: sparc SunOS (Solaris) Perl version: 5.005_03 Data File contents (2 rows of comma-delimited data; where eol is a newline): A,B,C,D 1,2,3,4 Actual Output: data file is '<filename provided from command line>' rows: D, A, B, C Expected Output: data file is '<filename provided from command line>' rows: D, A, B, C 4,1,2,3 Code: #### BEGIN SCRIPT ###### use strict; use DBI; use SQL::Statement; use SQL::Parser; # ===================== #- name of csv file provided from command line my $file = $ARGV[0] or die "syntax: perl $0 <csv filename>"; print "data file is '$file'\n"; # ===================== #-- create dbh my $dbh = DBI->connect('dbi:CSV:csv_eol=\n;csv_sep_char=,'); # ===================== #-- load csv_tables hash $dbh->{csv_tables}->{table}->{file} = $file; $dbh->{csv_tables}->{table}->{skip_rows} = 0; $dbh->{csv_tables}->{table}->{col_names} = [qw( col1 col2 col3 col4)]; # ===================== #-- establish query string my $query = 'SELECT col4, col1, col2, col3 FROM table'; # ===================== #-- prepare query my $sth = $dbh->prepare($query); # ===================== #-- execute query my $retcode = $sth->execute; # ===================== #-- evaluate execute return code die "query execution failed" unless ($retcode); die "zero rows found" if ($retcode eq '0E0'); # ===================== #-- display any fetched rows print "rows:\n"; my $rowref; while (my $rowref = $sth->fetch) { print " ", join(', ', @{$rowref}), "\n"; } #### END SCRIPT ###### andrew crum -- [EMAIL PROTECTED] -- senior software developer @ metagenix, inc.