open(DATA_FILE,"<:utf8",$filename) || die print "can not open reading file --> \"$filename\""; open DB, '| /opt/postgresql-9.4/bin/psql -h ... (here all the parameters)' print DB "copy $table($header) from STDIN CSV;\n"; while ( my $line = ) { print DB "$line"; }