use DBI; use strict; my $db = DBI->connect("DBI:CSV:"); # create table $db->do("create table testdb (NAME CHAR(20),POSTAL CHAR(20),TELEPHONE CHAR(20))"); # create dummy data my $sth=$db->prepare("insert into testdb (NAME,POSTAL,TELEPHONE) VALUES (?,?,?)"); for (1..10) { $sth->execute("name $_","postal $_","telephone $_"); } # update 2 lines of data with different format statements my $sth1 = $db->prepare("update testdb set NAME=?,POSTAL=?,TELEPHONE=? where name=?"); my $sth2= $db->prepare("update testdb set POSTAL=?,TELEPHONE=? where name=?"); $sth1->execute("name 9","postaladdress","123456","name 9"); $sth2->execute("postaladdress","123456","name 10"); # display the contents of testdb my $sth3 = $db->prepare("select * from testdb"); my $result = $sth3->execute(); my $line; while ($line = $sth3->fetchrow_arrayref) { for my $attrib (@$line) { print "$attrib\t"; } print "\n"; }