#!/usr/bin/perl use DBI; use strict; my($dsn) = 'DBI:mysql:test:webster.ncnr.nist.gov'; # data source name my($username) = 'nickm'; # User name my($password) = 'secret'; # Password my($dbh, $sth); # Database and statement handles my(@ary); # Array for rows returned by query # connect to database $dbh = DBI->connect($dsn,$username,$password); # issue query $sth = $dbh->prepare('SELECT * FROM Candidates'); $sth->execute(); # read results of query, then clean up while(@ary = $sth->fetchrow_array()) { print join("\t",@ary),"\n"; } $sth->finish(); $dbh->disconnect(); exit(0);