Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^4: Compare 2 Compare 2 CSV files and create a new CSV file out of comparision

by Tux (Monsignor)
on Jan 20, 2014 at 07:13 UTC ( #1071278=note: print w/ replies, xml ) Need Help??


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


Comment on Re^4: Compare 2 Compare 2 CSV files and create a new CSV file out of comparision
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1071278]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (17)
As of 2015-07-28 16:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls