#Set's the fields of the parsed file into a data array
@data=$csv->fields();
#Checks to make sure that all the lines aren't blank if not then continue.
if($#data == 20)
{
#Takes each field in the data array and sets it to the
#corosponding position in the database. If there is an error print
#out the message and quit
$sth->execute(@data->[0],@data->[1],@data->[2],@data->[3],@data->[4],@data->[5],@data->[6],@data->[7],@data->[8],
@data->[9],@data->[10],@data->[11],@data->[12],@data->[13],@data->[14],@data->[15],@data->[16])
or die "Couldn't execute: $DBI::errstr";
#increase the counter
$recnt++;
}
#If it fails print out the line that we couldn't parse
else
{
print "Unable to parse CSV line: ",$_, "\n";
}
}