#!/usr/bin/perl -w use strict; use DBI; my $dbh = DBI->connect('DBI:mysql:quotes', 'scott', 'some_password') or die "dumbass it didn't work: '$DBI::errstr'; stopped"; my $sth = $dbh->prepare(<execute() or die "Couldn't make query: '$DBI:errstr'; stopped"; while ( my ($count, $phrase, $author, $submitted_by) = $sth->fetch_array()) { print "Field1: $count\n Field2: $phrase\n Field3: $author\n Field4: $submitted_ by\n\n"; } $dbh->disconnect();