Do you have any specific example of pulling the raw data into DB?
I've not had cause to use Sqlite as I usually have another DB available. But this is the sort of thing you need. Untested and without checking for errors creating connections and opening files etc. Hopefully it will give you a start.
use DBI;
use DBD::Sqlite;
# Connect to your database
my $dbh = DBI->connect("dbi:sqlite:$db_name:localhost:$port", $db_user
+, $db_password);
# Create a temporary table
$dbh->do("CREATE TEMPORARY TABLE IF NOT EXISTS ExcelData (name VARCHAR
+(80), data INT)");
# Populate temporary table from your datasource
foreach my $row(@responsetext) {
my ($name, $data) = split / +/, $row
$dbh->do("INSERT INTO ExcelData SET name = '$name', data = $data")
+;
}
# Create a query to sort the data how you want it and output to CSV fi
+le
open $fh, '>', 'myfile.csv';
my $query = $dbh->prepare("SELECT name, data FROM ExcelData WHERE data
+ > 20 ORDER BY data");
$query->exceute;
my ($n, $d);
while (($n, $d) = $query->fetchrow_array) {
print $fh qq["$n",$d\n];
}
close $fh;