$su -
#export POSTGRES_HOME=/opt/PostgreSQL/9.3
#cpanm DBD::Pg
#!/usr/bin/perl
use encoding "utf-8";
use DBI;
$dbname="XXXX";
$user="XXXX";
$passwd="XXXX";
$dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=127.0.0.1;port=5432",$user,$passwd) or die "can't connect to database ". DBI-errstr;
$sth=$dbh->prepare("select * from STUDENT");
$sth->execute;
while (@recs=$sth->fetchrow_array) {
print $recs[0].":".$recs[1].":".$recs[2]."\n";
}
$dbh->disconnect;