[mysql@master ~]$ perl 1.pl
1aaa2014-01-01
2b2015-05-01
[mysql@master ~]$ cat 1.pl
#!/usr/bin/perl
use DBI;
$user="test";
$passwd="123456";
$dbh="";
$dbh = DBI->connect("dbi:mysql:database=plmsdb;host=10.10.17.5;port=3306",$user,$passwd) or die "can't connect to
database ". DBI-errstr;
$sth=$dbh->prepare("select * from person");
$sth->execute;
while (@recs=$sth->fetchrow_array) {
foreach (@recs)
{print "$_"}
print "
";
}
$dbh->disconnect;
[mysql@master ~]$ perl 1.pl
1aaa2014-01-01
2b2015-05-01