#!/usr/bin/perl
# Note the perl DBI module needs to be installed, along with the DBI connector
# for your specific database--DBI--in this case.... 
# NOTE, for this program to work, you need to fill in the particulars of 
# your own database here, in the [] brackets

#This approach stores the results of a SQL call in an array. In this example,
#the query is calling for rows with three columns of data, and printing each
#row

use DBI;

$dbh = DBI->connect('DBI:mysql:[DATABASE]', '[USER]', '[PASSWORD]')
			|| die "ERROR: $DBI::errstr";

$query = "[SQL QUERY GOES HERE]";

$sth = $dbh->prepare($query);

$sth->execute();

$data = $sth->fetchall_arrayref();
$sth->finish;

foreach $data ( @$data) {

	($variable1, $variable2, $variable3) = @$data;

	print "$variable1\n";
	print "$variable2\n";
	print "$variable3\n";

					}

$dbh->disconnect();


