On Sat, 12 Mar 2005, Gomez, Juan wrote:

> Book1;document11;document12;document13;document14;document15;document16
> Book2;document21;document22;document23;document24;document25;document26
> Book3;document31;document32;document33;document34;document35;document36
> Book4;document41;document42;document43;document44;document45;document46
> Book5;document51;document52;document53;document54;document55;document56

This is a variant of the CSV format that uses Semi-colons instead of 
Commas to Separate Values. Handling these is a common task, and there's 
a variety of CPAN modules that can do this work for you.

One popular approach to CSV in Perl is the module DBD::CSV, which lets 
you treat the CSV file as if it were a table in a database. This lets 
you do all the normal SQL operations that can be done on databases -- 
including INSERT, UPDATE, DELETE, and in this case, SELECT. 

The DBD::CSV module is a driver plugin for the DBI database interface 
module. To use it, you write a generic DBI interaction script that makes 
use of DBD::CSV to handle interacting with your data files. 

There's lots of documentation on how to work with all this, including 
the books _Programming the Perl DBI_ (which is entrely about DBI) and 
_Data Munging with Perl_, which goes over all kinds of data processing 
tasks, including handling CSV data using DBI/DBD::CSV. There's also the 
web, of course -- these urls are a good start:

    <http://search.cpan.org/~jzucker/DBD-CSV-0.21/lib/DBD/CSV.pm>
    <http://search.cpan.org/~timb/DBI/DBI.pm>
    <http://www.oreilly.com/catalog/perldbi/chapter/ch04.html>
    <http://www.perl.com/pub/a/1999/10/DBI.html>

Take a look over this material and you should start to see how you can 
adapt it to your specific problem.

Come up with some specific questions, &/or some code, and the people on 
the list would be happy to give you a hand.
 


-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to