#!/usr/bin/perl -w use strict; use DBI; use File::Basename; my $dir = '.'; my $file = 'memberlist.csv'; my $table = (fileparse($file,'.csv'))[0]; my $cols = [qw(Username Email Posts EmailSet Group Unknown Date Timestamp Password MD5)]; my $sep = ','; my $dbh = DBI->connect( "DBI:CSV:f_dir=$dir;csv_eol=\n;csv_sep_char=$sep;", {RaiseError=>1},); $dbh->{csv_tables}->{$table} = { file => $file, col_names => $cols,}; my $sth = $dbh->prepare("SELECT Username, Email, Posts, Timestamp FROM memberlist"); $sth->execute() or die "Cannot execute: " . $sth->errstr(); while ( ( my $Username, my $Email, my $Posts, my $Timestamp) = $sth->fetchrow_array) { print "$Username, $Email, $Posts, $Timestamp\n"; } $sth->finish();