http://www.perlmonks.org?node_id=796356


in reply to Re: Query Language with Flat Files
in thread Query Language with Flat Files

Using DBD::AnyData
#!/usr/bin/perl -w use strict; use diagnostics; use DBI; my $dbh = DBI->connect( 'dbi:AnyData(RaiseError=>1):' or die $DBI::err +str ); $dbh->func( 'example', 'CSV', 'DEMO.db', { sep_char => ',', # eol => "\015", col_names => 'name,username,time,num1,num2' }, 'ad_catalog' ); my $sth = $dbh->prepare("SELECT time, name, username, num1, num2 FROM +example"); $sth->execute() || die "can't fetch all usernames"; while ( my $row = $sth->fetch ) { print "@$row\n"; } $sth = $dbh->prepare("SELECT username FROM example"); $sth->execute() || die "can't fetch all usernames"; while ( my $row = $sth->fetch ) { print "@$row\n"; }