#!/usr/bin/perl use strict; use DBI(); my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost", "root", "123xyz", {'RaiseError' => 1}); my $sth = $dbh->prepare("SELECT * FROM regtest"); $sth->execute(); while ((@row) = $sth->fetchrow_array()) { print "@row\n"; } $sth->finish(); $dbh->disconnect();