#!/usr/bin/perl use DBI; use IO::File; use strict; my $db = "CAMDPAMS"; my $host = "192.168.8.10"; my $file = "world_country.txt"; #my $file = shift; my @fn; my $sql; my $fh = new IO::File; my $dbh = DBI ->connect("dbi:Pg:dbname=$db;host=$host","olegk","4Q2073gl",{AutoCommit=>0,RaiseError=>1,ChopBlanks=>1}); $dbh->do("truncate table mis.\"country_name\""); my $sth = $dbh->prepare("INSERT INTO mis.\"country_name\"(\"CountryName\") VALUES (?)"); open(FI,'<',"$file"); my @strings=; foreach my $line (@strings) { chomp $line; $sth->execute($line) ; } close(FI); $sth->finish; $dbh->commit; $dbh->disconnect;