in reply to parsing a file
There are lots of ways that you could do this. But firstly, you didn't say what you want to do with data_line[4|5|6]?
But anyway, lets assume that you want to ignore them. Then you could do something like:
Update: Actually, don't do that - it's bad because it doesn't use placeholders. Here is a better method, following from the example given in the DBI recipes Tutorials.
You would then pass your @data list to db->execute, eg $dbh->execute(@data);my $fieldlist = join(",", @fields); my $placeholders = join(",", map {'?'} @fields); my $insert = qq{ INSERT INTO foo ($fieldlist) VALUES ($placeholders)};
Cheers,
Darren :)
|
|---|