use strict; use warnings; use DBI; my $dbname="test_development"; my $dbh=DBI->connect("DBI:mysql:$dbname","root") || die("connection failure"); my $sth=$dbh->prepare("select * from tables"); $sth->execute(); while(my @row=$sth->fetchrow_array()){ print "id".$row[0]; print "name".$row[1]; print "age".$row[2]; }