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


in reply to Re^3: Compare 2 CSV files and create a new CSV file out of comparision
in thread Compare 2 CSV files and create a new CSV file out of comparision

Overly complicated. Why use file and file1? That doesn't say anything in the queries, making them hard to read.

my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { f_dir => ".", f_ext => ".csv/r", RaiseError => 1, PrintError => 1, }) or die "Could not open database: $DBI::errstr"; my $result = $dbh->selectall_arrayref (join " " => "SELECT vm.vm_name, vm_cluster, vFiler_IP, vFiler_cluster", "FROM vm JOIN vfiler_ds", "WHERE vm.vm_name = vfiler_ds.vm_name");

Using f_ext - which you already do - just add /r to make the extension required, and just use the file names as table names in the query.

As the f_*** attributes are just DBI attributes (passed to DBD::File eventually), you can put RaiseError and other DBI attributes in the same hash.


Enjoy, Have FUN! H.Merijn