#!/usr/bin/perl -wT # example 11-3 use strict; use DBI; my $dbh = DBI->connect("DBI:mysql:book","book","addison") or die "Error: $DBI::errstr\n"; my $sql = "SELECT sku, name, descr, stock FROM products"; my $sth = $dbh->prepare($sql); $sth->execute; my $data = $sth->fetchall_arrayref; foreach (@$data){ print join(' * ', @$_), "\n"; } print "\n\n"; print "Below is the 2nd record, 3rd column:\n"; print $data->[1][2], "\n\n"; $dbh->disconnect;