#!/usr/bin/perl -w use strict; use DBI; use DBD::RAM; my $dbh = DBI->connect('DBI:RAM:','usr','pwd',{RaiseError=>1}); $dbh->{f_dir} = '.'; # (default), or your path: '/path/to/files' $dbh->func([ [ 'items', 'PIPE', 'ramdata', {col_names => 'id,category,subcat,code,description,picture' } ], ],'catalog'); my $query = "select * from items where subcat='PEN' order by code"; my $sth = $dbh->prepare($query)|| die print $DBI::errstr; $sth->execute || die print $DBI::errstr; my @row; while ( @row = $sth->fetchrow_array ) { print join(" ",@row),"\n"; # or try this.. print "\n"; } # DBD::RAM lets you access a file with SQL. PIPE separated # is a built-in type which lets you read from one file and # write to another one without storing the whole thing in memory. # Headings can come from the top of the file if you have a line # containing them. # You don't need a separate database server, just DBI, DBD::RAM, # and SQL::Statement. It can access remote files, and # use different kinds of tables at the same time.