#!/usr/local/bin/perl use DBI; $dbh = DBI->connect('dbi:mysql:ram','root','root') or die "Connection Error: $DBI::errstr\n"; $sql = "select * from test1"; $sth = $dbh->prepare($sql); $sth->execute or die "SQL Error: $DBI::errstr\n"; while (@row = $sth->fetchrow_array) { print "@row\n"; }