Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 rifling through the Monastery: (6)
As of 2014-12-27 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls