#!/usr/bin/env perl use Data::Dumper; use DBI; use Try::Tiny; use strict; use warnings; try { my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { f_dir => "./", f_ext => ".csv/r", f_lock => 2, csv_eol => "\r\n", csv_sep_char => "|", RaiseError => 1, PrintError => 1, FetchHashKeyName => "NAME_lc", }) or die $DBI::errstr; # Sorting by author my $sth=$dbh->prepare(<<"__SQL__"); select * from books order by author __SQL__ $sth->execute(); my $field_aref=$sth->{NAME_lc}; warn Data::Dumper->Dump([\$field_aref],[qw(*field_aref)]),' '; while (my $value_aref=$sth->fetchrow_arrayref()) { warn Data::Dumper->Dump([\$value_aref],[qw(*value_aref)]),' '; }; } catch { Carp::confess $!; };