Skip to content

Instantly share code, notes, and snippets.

@osfameron
Created April 30, 2010 22:09
Show Gist options
  • Save osfameron/385829 to your computer and use it in GitHub Desktop.
Save osfameron/385829 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Data::Dumper;
use DBI;
my $dbh = DBI->connect( 'dbi:CSV:', '', '',
{f_dir => '.',
f_ext => ".asc/r",
csv_sep_char => "\t",
})
or die "Cannot connect $DBI::errstr";
$dbh->{csv_tables}{table1} = {
col_names => [qw/ alpha bravo charlie delta echo foxtrot /],
};
my $sth = $dbh->prepare(
'select alpha, charlie, echo from table1
order by alpha, bravo, charlie, delta, echo, foxtrot'
) or die $dbh->errstr;
$sth->execute or die $sth->errstr;
print Dumper( $sth->fetchall_arrayref({}) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment