SORTORDER,POSITION,NAME,EMAIL
1,"First Position","Tanktalus","tanktalus -at- gmail.com"
####
use DBI;
use SQL::Statement;
use DBD::CSV;
use strict;
use warnings;
my $dbh;
my $csv_dir = '.';
sub _dbh {
$dbh ||= DBI->connect(qq{DBI:CSV:f_dir=$csv_dir;csv_eol=\n}, undef, undef, {RaiseError => 1});
$dbh;
}
sub getme
{
#_dbh->{TraceLevel}=10;
my $f = _dbh->selectall_arrayref(qq{select name from mytable where position = ?}, {}, 'First Position');
$f = $f->[0] while ref $f;
$f;
}
sub getme2
{
#_dbh->{TraceLevel}=10;
my $f = _dbh->selectall_arrayref(qq{select name from mytable where sortorder = ?}, {}, 1);
$f = $f->[0] while ref $f;
$f;
}
print "SQL::Statement's version: ", $SQL::Statement::VERSION, $/;
print "DBD::CSV's version: ", $DBD::CSV::VERSION, $/;
print getme,$/;
print getme2,$/;
####
$ perl ./q.pl
SQL::Statement's version: 1.15
DBD::CSV's version: 0.22
Use of uninitialized value in print at ./q.pl line 32.
Tanktalus
####
$ perl ./q.pl
SQL::Statement's version: 1.15
DBD::CSV's version: 0.22
Tanktalus
Tanktalus