#!/usr/bin/perl use strict; use DBI; # Connect to the database. my $dbh = DBI->connect("dbi:mysqlPP:database=cdcol;host=localhost", "USER", "PW", {'RaiseError' => 1}); # Now retrieve data from the table. my $sth = $dbh->prepare("SELECT id, title FROM cdcol"); $sth->execute(); while (my $ref = $sth->fetchrow_arrayref()) { print "Found a row: id = $ref->[0], name = $ref->[1]\n"; } $sth->finish(); # Disconnect from the database. $dbh->disconnect();