in reply to Re: CSV column names
in thread CSV column names

I tried this with one of my CSV files.

Not sure what is going on.

#!/bin/env perl use strict; use warnings; use DBI; my $dbh = DBI->connect('DBI:CSV:'); $dbh->{csv_tables}{info} = { file => '2011-SSCW.csv' }; #Gives 'Not an ARRAY reference at C:\Projects_Perl\SSPH_Results\Muskra +t.pl line 11.' #my @cols = @{$dbh->{csv_tables}}; #print "column names: @cols\n"; my $qu = $dbh->prepare('select * from info'); $qu->execute(); ## for unknown reasons, fetchrow_array returns undef values ## I hacked this in to get the CSV contents while( my @row = grep{defined $_}$qu->fetchrow_array) { print "row: @row\n"; #I get the CSV file ok, here }

Replies are listed 'Best First'.
Re^3: CSV column names
by Mr. Muskrat (Canon) on Aug 23, 2016 at 22:14 UTC

    I've updated my script now that I have had a chance to try it.