in reply to DBI and Inserting an Array
Here's how I would do it:
my $dbh = DBI->connect( ... ); # fill in the arguments you need my $sth = $dbh->prepare(<<'SQL'); INSERT INTO ads (lname,fname,item,price,street,city,state,zip) VALUES (?,?,?,?,?,?,?,?) SQL while (my $line = <SOME_FILEHANDLE>) { # ... parse $line to get data in @array... you've done this # assuming @array contains 8 values, this inserts the data $sth->execute(@array); }
You'd want to check for errors on the insert though if you don't have RaiseError or an error handler in place.
|
|---|