There room for a some small improvements.
- You don't check the result of $dbh->prepare.
- You don't check the result of $dbh->fetchrow_array.
- Your loop can be replaced with $sth->fetchall_arrayref.
- You can also condense the code further using $dbh->selectall_arrayref.
use strict;
use warnings;
use DBI ();
use HTML::TableTiler ();
my $dbh = DBI->connect("DBI:mysql:project")
or die "Can't connect to Oracle database: $DBI::errstr\n";
my $matrix = $dbh->selectall_arrayref("SELECT * FROM modules");
die "Unable to fetch query results: $DBI::errstr\n" if $dbh->err;
my $tt = HTML::TableTiler->new();
print $tt->tile_table($matrix);
Update: I was obviously tired! Fixed the problems identified in replies.