#!/usr/bin/perl -w use strict; use DBI; my $dbh = DBI->connect("DBI:mysql:db;host=host.com", 'user', 'pw') or die ("Could not connect: " . DBI->errstr ); open GLEANDATA, 'gleandata.csv' or die "Could not open file\n"; my @row; my $sth; my $line; while () { $line = $_; my @row = split(/:/, $line); $sth = $dbh->prepare("INSERT INTO glean_data (gleaner, contact_name, title_position, city, county, phone, email, dates_called, possible_donation, notes_comments, followup_needed, mailing_address, physical_address, crops, specific_crop, estimated_quantity, estimated_labor, possible_glean_dates_times, ladders_to_lend, picking_bags_to_lend, bins_or_boxes, existing_relationship, status, time_of_year_to_call) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); $sth->execute(@row); } close GLEANDATA or die "Could not close file\n"; $dbh->disconnect;