use DBD::CSV (); use if $DBD::CSV::VERSION < 0.50, File::BOM => (); # ^---- adjust to working version number my $dbh=DBI->connect( 'dbi:CSV:', undef, undef, { RaiseError => 1, PrintError => 0, f_ext => '.csv', ( # v---- adjust to working version number $DBD::CSV::VERSION < 0.50 ? (f_encoding => 'utf-8):via(File::BOM') : (csv_bom => 1) ) } );