#!/usr/bin/perl use DBI; # Connect to database, turn on error reporting our $db = DBI->connect("DBI:CSV:f_dir=db/"); $db->{RaiseError} = 1; my $sth = $db->prepare(" SELECT * FROM link JOIN link_to_category WHERE id=category_id "); $sth->execute; while($row = $sth->fetchrow_hashref) { foreach $key (keys %{$row}) { print "$key -> $row->{$key}\n"; } print "---\n"; }